-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When dragging a node in the brain map, insert a temporary node to show the current inserted position, but it is always stuck and cannot be continued #6509
Comments
是想在拖动的过程中实时的更新这个节点将要插入的位置,每次一插入临时节点就卡死了 |
const treeLayout = {
};
mindMapTree.render(); |
麻烦帮忙看下,拖拽改变节点的顺序,得有一个临时节点在拖拽过程中实时插入图里显示当前插入位置,就像xmind 软件里面拖拽节点的功能那样,我在插入临时节点的时候渲染就卡住了,不知道怎么解决 |
麻烦帮忙看一下 |
@wangtao-bugkiller 麻烦提供一个可以访问的线上 demo |
https://codesandbox.io/p/sandbox/sleepy-hooks-rlks3w?workspaceId=3c65d4d0-3ed1-4d5e-882b-b9fa0b0c9753 |
Describe the bug / 问题描述
脑图里面拖拽节点的时候,去插入一个临时节点来显示当前插入的位置,总是卡死无法继续
Reproduction link / 重现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
let dragNodeOriPos,
minDisNode,
minDisNodeId,
dragRect,
insertPos,
insertIndex,
lastInsertPostion,
lastMinDisNode,
lastMinDisNodeId,
targetIndex,
newParentId,
newParentNode,
targetInsertIndex,
targetParentID;
/**
*/
const collide = (node, rect, x, y) => {
// 如果节点不存在,直接返回false
if (!node) return false;
};
/**
*/
const traversNodes = (item, callback) => {
// 初始化新节点和新索引变量
let newNode,
newIndex = 0;
};
const traversRootNodes = e => {
var found = false,
nodeId = e.getID();
// 遍历树的根节点以判断是否为根节点
G6.Util.traverseTree(mindMapTree.save(), function(node, isRoot) {
if (!isRoot || node.id !== nodeId) {
found = true;
return false;
}
});
return found;
};
const registerBehavior = () => {
G6.registerBehavior('dice-mindmap', {
getEvents() {
return {
'node:click': 'clickNode',
'node:dblclick': 'editNode',
'node:mouseenter': 'hoverNode',
'node:mouseleave': 'hoverNodeOut',
};
},
clickNode(evt) {
const model = evt.item.get('model');
const name = evt.target.get('action') || '';
const parent = evt.item.get('parent');
const { x, y, images } = model;
const image = Array.isArray(images) ? [...images] : [];
const point = mindMapTree.getCanvasByPoint(x, y);
setNodeContextMenuX(point.x);
setNodeContextMenuY(point.y + 40);
if (model.id !== currentNode?.get('model')?.id) {
setShowDeleteMenu(false);
}
setCurrentNode(evt);
const regex = /previewPic(\d+)/;
const match = name.match(regex);
const regexDel = /deletePic(\d+)/;
const matchDel = name.match(regexDel);
};
G6 Version / G6 版本
4.x
Operating System / 操作系统
macOS
Browser / 浏览器
Chrome
Additional context / 补充说明
No response
The text was updated successfully, but these errors were encountered: