perf: 解耦移动相关后退、前进逻辑

This commit is contained in:
yangwq7
2022-08-30 14:14:56 +08:00
parent 9fea20cb79
commit 36bfbf900a
4 changed files with 33 additions and 62 deletions
@@ -279,6 +279,15 @@ export const useMouseHandle = () => {
chartEditStore.setEditCanvas(EditCanvasTypeEnum.IS_DRAG, false)
// 加入历史栈
if(prevComponentInstance){
chartEditStore.getTargetChart.selectId.forEach(id => {
if (!targetMap.has(id)) return
const index = chartEditStore.fetchTargetIndex(id)
const curComponentInstance = chartEditStore.getComponentList[index]
prevComponentInstance.attr = Object.assign(prevComponentInstance.attr, {
offsetX: curComponentInstance.attr.x - prevComponentInstance.attr.x,
offsetY: curComponentInstance.attr.y - prevComponentInstance.attr.y
})
})
chartEditStore.moveComponentList(prevComponentInstance)
}
document.removeEventListener('mousemove', mousemove)