hookehuyr

fix

......@@ -3,9 +3,6 @@
"private": true,
"version": "0.0.0",
"type": "module",
"engines": {
"node": "18.13.x"
},
"scripts": {
"dev": "vite",
"build": "vite build",
......
......@@ -34,6 +34,14 @@ onMounted(() => {
console.log("文本更新为:", data.text);
});
// 添加节点移动规则
lf.graphModel.addNodeMoveRules((nodeModel, x, y) => {
if (nodeModel.properties.disabled) {
return false; // 禁止移动
}
return true; // 允许移动
});
// 渲染初始数据
lf.render({
nodes: [
......@@ -50,6 +58,26 @@ onMounted(() => {
x: 200,
y: 200,
text: "点击编辑文本"
},
{
id: "node11",
type: "rect",
x: 300,
y: 300,
text: "可移动节点",
properties: {
disabled: false
}
},
{
id: "node21",
type: "custom-rect",
x: 400,
y: 400,
text: "禁止移动节点",
properties: {
disabled: true
}
}
]
});
......