Skip to content

Commit 1baaa9f

Browse files
committed
feat: add updateArrowDelta event for arrow delta updates
1 parent ebcff57 commit 1baaa9f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/arrow.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,10 @@ const showLinkController = function (mei: MindElixirInstance, linkItem: Arrow, f
273273
x2: p2x + '',
274274
y2: p2y + '',
275275
})
276-
// update linkItem
277276
linkItem.delta1.x = p2x - fromData.cx
278277
linkItem.delta1.y = p2y - fromData.cy
278+
279+
mei.bus.fire('updateArrowDelta', linkItem)
279280
})
280281

281282
mei.helper2.init(mei.map, (deltaX, deltaY) => {
@@ -306,6 +307,8 @@ const showLinkController = function (mei: MindElixirInstance, linkItem: Arrow, f
306307
})
307308
linkItem.delta2.x = p3x - toData.cx
308309
linkItem.delta2.y = p3y - toData.cy
310+
311+
mei.bus.fire('updateArrowDelta', linkItem)
309312
})
310313
}
311314

src/utils/pubsub.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ export type EventMap = {
8585
expandNode: (nodeObj: NodeObj) => void
8686
linkDiv: () => void
8787
scale: (scale: number) => void
88+
/**
89+
* please use throttling to prevent performance degradation
90+
*/
91+
updateArrowDelta: (arrow: Arrow) => void
8892
}
8993

9094
const Bus = {

0 commit comments

Comments
 (0)