fanyang
fanyang
可以把你编写的 demo 提供下吗
你的vue数据流有问题,你的vue数据和logicflow数据不对应,我算了回退步长是没问题的,你改两次propertise数据,就可以回退两次undo,logicFLow是没问题的。 你可以参考vue demo: https://examples.logic-flow.cn/demo/dist/mvp 源码:https://github.com/Logic-Flow/docs/tree/master/demo/mvp 后续还有问题可以再交流~
我没细看这个demo,撤销一步需要连续点两次撤销,我也发现了,发生在点击节点弹出属性面板的时候,这一步可能会有修改properties的操作,所以需要点两次,LogicFlow的undo是没问题的。
先吃饭₍˄·͈༝·͈˄*₎◞ ̑̑ 在 2024-08-27 12:01:11,"Kirito丶城" ***@***.***> 写道: @FanSun521 我现在有点无从下手,如果能知道这个撤销的计算方式,那么应该能有些帮助,麻烦了。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID:...
这边计算的撤销逻辑是 GraphData 中有数据变会往undos队列存一次 graphData 画布数据 源码地址:https://github.com/didi/LogicFlow/blob/master/packages/core/src/history/index.ts
你每次undo都会额外执行activeData = undefine,我觉得你这里会有问题: @undo="activeData = undefined"
> > 你每次undo都会额外执行activeData = undefine,我觉得你这里会有问题: @undo="activeData = undefined" > > 应该不是这样原因,因为 `activeData` 与 logicFlow 的数据无关,这个是我自己存的数据。我去除了这两个事件问题依旧存在。 lf.value?.setProperties(activeData.value.id, toRaw(activeData.value.properties)); 这样就ok了
> > > > 你每次undo都会额外执行activeData = undefine,我觉得你这里会有问题: @undo="activeData = undefined" > > > > > > > > > 应该不是这样原因,因为 `activeData` 与 logicFlow 的数据无关,这个是我自己存的数据。我去除了这两个事件问题依旧存在。 > > > > > >...
- 我发现 setProperties 会触发UserTaskModel的 construtor 很奇怪 - redo/undo 是基于graphData的,graphData变了就会重新new 节点,执行constructor这个是符合预期的,解决办法: this.properties = { ...new DefaultUserTaskProperties(), ...this.properties }; new DefaultUserTaskProperties()优先级低一些试一下 - 我现在人晕了,排查不出来问题了