File tree Expand file tree Collapse file tree 1 file changed +0
-30
lines changed
Expand file tree Collapse file tree 1 file changed +0
-30
lines changed Original file line number Diff line number Diff line change @@ -524,42 +524,12 @@ export class GraphModel {
524524 this . edgeModelMap . set ( edgeModel . id , edgeModel )
525525 this . elementsModelMap . set ( edgeModel . id , edgeModel )
526526
527- // 对齐边的端点
528- this . alignEdgeEndpoints ( edgeModel )
529527 return edgeModel
530528 } )
531529 } else {
532530 this . edges = [ ]
533531 }
534532 }
535- /**
536- * 对齐边的起点/终点到其当前锚点坐标
537- * 用途:
538- * - 在撤销/重建(graphDataToModel)以及网格吸附、节点旋转后,确保边端点与锚点不产生偏移
539- */
540- private alignEdgeEndpoints ( edgeModel : BaseEdgeModel ) {
541- // 根据边的源/目标节点 id 获取节点 model
542- const sourceNode = this . nodesMap [ edgeModel . sourceNodeId ] ?. model
543- const targetNode = this . nodesMap [ edgeModel . targetNodeId ] ?. model
544- // 有源锚点 id 时,对齐起点到源锚点的当前坐标
545- if ( sourceNode && edgeModel . sourceAnchorId ) {
546- const startAnchor = sourceNode . anchors . find (
547- ( a ) => a . id === edgeModel . sourceAnchorId ,
548- )
549- if ( startAnchor ) {
550- edgeModel . updateStartPoint ( { x : startAnchor . x , y : startAnchor . y } )
551- }
552- }
553- // 有目标锚点 id 时,对齐终点到目标锚点的当前坐标
554- if ( targetNode && edgeModel . targetAnchorId ) {
555- const endAnchor = targetNode . anchors . find (
556- ( a ) => a . id === edgeModel . targetAnchorId ,
557- )
558- if ( endAnchor ) {
559- edgeModel . updateEndPoint ( { x : endAnchor . x , y : endAnchor . y } )
560- }
561- }
562- }
563533
564534 /**
565535 * 获取画布数据
You can’t perform that action at this time.
0 commit comments