Skip to content
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

[Bug report]在有些情况下给组节点添加指定的坐标时会自动添加或减少10个点的坐标,导致始终无法对齐 #1276

Closed
tianya520 opened this issue Aug 15, 2023 · 1 comment
Labels
invalid This doesn't seem right

Comments

@tianya520
Copy link

问题描述

手动绘制泳道图时发现的问题,自定义分组,在index里面写好了坐标,将坐标数据传入GroupNode.model之后发现有的坐标会被自动添加10个点的坐标,导致图无法对齐,拖动也一样,永远无法拖动到线上对齐,不是自动添加10个点,就是少了10个点的坐标,希望能修复这个问题

最简复现

imagedemo:
image

const num = 4
const childrenLaneNodes = []

const childrenlaneWidth = 350
const childrenlaneHeight = 700
for (let i = 0; i < num; i++) {
const nodeId = lane_${i + 1}
// childrenLanes.push(nodeId)
const x = 300 + (i * childrenlaneWidth)
childrenLaneNodes.push(
{
type: 'lane',
x: x,
y: 400,
width: childrenlaneWidth,
height: childrenlaneHeight,
resizable: false,
draggable: false,
id: nodeId,
},
)
}
console.log(childrenLaneNodes)
graphData.value = {
nodes: [
...childrenLaneNodes
],
}
lf.render(graphData.value)

import { GroupNode } from '@logicflow/extension'

class lane extends GroupNode.view {}

class LaneModel extends GroupNode.model {
initNodeData(data: any) {
console.log(data, 111)
super.initNodeData(data)
this.isRestrict = true
this.resizable = data.resizable === undefined ? false : data.resizable
this.draggable = data.draggable === undefined ? true : data.draggable
this.width = data.width ? data.width : 500
this.height = data.height ? data.height : 500
}
getNodeStyle() {
const style = super.getNodeStyle()
style.stroke = '#AEAFAE'
style.strokeWidth = 1
return style
}
getAnchorStyle() {
const style: any = super.getAnchorStyle({})
style.stroke = 'transparent'
style.fill = 'none'
style.hover.stroke = 'transparent'
return style
}
}

export default {
type: 'lane',
model: LaneModel,
view: lane
}

@tianya520
Copy link
Author

打扰了,是网格的缘故,网格对齐,去掉网格就好了

@boyongjiong boyongjiong added wontfix This will not be worked on invalid This doesn't seem right and removed wontfix This will not be worked on labels Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants