feat(v0.4a): grid snap on gizmo drag (hold Cmd/Ctrl)#33
Merged
Conversation
按住 Ctrl/Cmd 拖拽时把位置吸附到网格步长(0.5);snapTranslation 纯函数引擎(供 B/C 扩展)+ ThreeViewport objectChange hook + 修饰键追踪;mouseUp 提交不变(可撤销)。 仅平移;节点对齐/socket/旋转缩放吸附延后。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
objectChange 时(translate 模式 + 修饰键按住)用 snapTranslation 吸附 obj.position; mouseUp 提交吸附后 transform(可撤销,不改);window keydown/keyup/blur 追踪修饰键 + cleanup 移除。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
修复:没按 Ctrl/Cmd 也吸附——keydown/keyup 累积的修饰键状态会因 keyup 丢失 (Cmd+Z/Cmd+Tab)卡在 true。改为拖拽时从 pointermove/pointerdown(capture 阶段) 读即时 e.ctrlKey||e.metaKey,不卡住;不按修饰键即自由拖动。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <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.
What
v0.4「空间吸附 / Socket 系统」第一个 sub-stage(基础):gizmo 平移拖拽时按住 Ctrl/Cmd 吸附到 0.5 网格。
snapTranslation纯函数吸附引擎(src/core/snap/grid.ts,可单测,供 sub-stage B/C 扩展)。ThreeViewportgizmoobjectChangehook:translate 模式 + 修饰键按住时吸附obj.position;mouseUp不变(可撤销)。window keydown/keyup/blur 追踪修饰键。Why
How to test
🤖 Generated with Claude Code