MCPcopy Create free account
hub / github.com/1Panel-dev/MaxKB / updatePathByAnchor

Method updatePathByAnchor

ui/src/workflow/common/edge.ts:203–230  ·  view source on GitHub ↗

* 给边自定义方案,使其支持基于锚点的位置更新边的路径

()

Source from the content-addressed store, hash-verified

201 * 给边自定义方案,使其支持基于锚点的位置更新边的路径
202 */
203 updatePathByAnchor() {
204 const sourceNodeModel = this.graphModel.getNodeModelById(this.sourceNodeId)
205 const sourceAnchor = sourceNodeModel
206 .getDefaultAnchor()
207 .find((anchor: any) => anchor.id === this.sourceAnchorId)
208
209 const targetNodeModel = this.graphModel.getNodeModelById(this.targetNodeId)
210 const targetAnchor = targetNodeModel
211 .getDefaultAnchor()
212 .find((anchor: any) => anchor.id === this.targetAnchorId)
213 if (sourceAnchor && targetAnchor) {
214 const startPoint = {
215 x: sourceAnchor.x,
216 y: sourceAnchor.y,
217 }
218 this.updateStartPoint(startPoint)
219 const endPoint = {
220 x: targetAnchor.x,
221 y: targetAnchor.y,
222 }
223
224 this.updateEndPoint(endPoint)
225 }
226
227 // 这里需要将原有的pointsList设置为空,才能触发bezier的自动计算control点。
228 this.pointsList = []
229 this.initPoints()
230 }
231 setAttributes(): void {
232 super.setAttributes()
233 this.isHitable = true

Callers 7

refreshBranchMethod · 0.45
refreshBranchMethod · 0.45
setHeightMethod · 0.45
refreshBranchMethod · 0.45
refreshBranchMethod · 0.45
refreshDegesMethod · 0.45
setHeightMethod · 0.45

Calls 2

findMethod · 0.45
getDefaultAnchorMethod · 0.45

Tested by

no test coverage detected