Repository navigation
feat(canvas): 删节点、删连线、拖卡换泳道可撤销,撤销卡撤的是卡上那一步(第二批 W3 · undo-adopt-existing) - #322
Merged
Merged
Conversation
- 新增 models/commands/:DeleteNodesCommand(restoreAll 一次复原,0 行 ⇒ gone,含导入节点时重载节点控制器; 重做换新令牌)、DeleteEdgeCommand(按两端 + 类型找边,同两端已有在世边视为已复原)、 MoveNodesCommand + MoveNodesLabel(位移按目标 − 此刻位置算,一次 moveNodes) - 新增 util/canvas_edge_delete.dart 的 deleteEdgeWithUndo:舞台选中线的 ✕ 与检查器入边区「移除」共用, 检查器移除失败不再吞掉 - canvas_node_delete:成功即 record + 按步出卡,不再以 context.mounted 为前提;删掉 _restore / _restoreAll - canvas_snackbars:showCanvasUndoSnack 增加按步用法(canvasId + stepId),新增不依赖 context 的 showCanvasUndoSnackWith(卡上「撤销」= runCanvasUndoStep,卡绑到步上随步收起);showUndoToast 原样保留 - node_card_slot:换道成功后 record MoveNodesCommand 并按步出卡,删掉闭包撤销 - 测试:三个命令测试、删节点撤销栈用例、换道 Ctrl Z、撤销卡按步 / 收卡、检查器移除失败;canvas_view_test 只改 fake Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
删节点(单删 / 多删)、删连线、拖卡换泳道,现在都记进画布撤销栈:Ctrl Z / ⌘Z 能撤,撤销卡上的「撤销」撤的是卡上那一步(不是栈顶),关掉画布后残留的卡点了不再生效。
改了什么
models/commands/:DeleteNodesCommand(复原 = restoreAll,返回 0 ⇒ 这一步作废;复原里含导入节点时让节点控制器重载)、DeleteEdgeCommand(按两端找边,同两端已有在世边 ⇒ 不重复复原)、MoveNodesCommand(回到原位置与原泳道;步名存泳道原名,显示时才落成「未命名」)。util/canvas_edge_delete.dart:deleteEdgeWithUndo,舞台连线删除键与检查器输入行「移除」共用;context / ref 在第一次 await 前取齐。检查器「移除」失败现在会出错误卡(以前静默吞掉)。canvas_snackbars.dart:新增showCanvasUndoSnackWith(按步撤 + 绑卡,步被撤掉 / 画布关闭 ⇒ 卡收起);showCanvasUndoSnack保留两种用法(按步登记 / 只给 onUndo 回调)。泳道解散 / 删除仍走showUndoToast,不变。已知、不在本 PR 修
验证(最终 head)
flutter analyze lib test:No issues foundflutter test -j 4 --exclude-tags golden:4017 全绿🤖 Generated with Claude Code