feat(v0.4b): node-align snap (bbox features -> other nodes)#34
Merged
Conversation
拖拽 + Ctrl/Cmd 时被拖节点 bbox 特征(中心+8角)吸附到其它节点对应特征(屏幕像素 阈值 12px 内最近对对齐),命中优先否则回退 A 的 grid。snapToNodes 纯函数(收已投影 屏幕点,可单测)+ ThreeViewport mouseDown 缓存目标 + objectChange 节点吸附 + 投影。 Smart Guides/面边特征/旋转缩放吸附延后。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ested) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…lback mouseDown 缓存其它节点 bbox 特征(中心+8角,投影屏幕);objectChange 时被拖节点特征 与缓存目标比,屏幕 12px 内最近对 → obj.position.add(offset),否则回退 grid(A)。 bboxFeatures/toScreen/featureSnapPoints 模块 helper。mouseUp 提交不变(可撤销)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… align) 反馈:box 对 box 角能贴,但球放 box 顶面/侧面对齐难(拖很久)——根因 bbox 特征只有 中心+8角,缺面中心。bboxFeatures 加 6 个面中心(±X/±Y/±Z 面),让球底面中心↔box
Two visual-feedback issues from sub-stage B node-align snapping: 1. Depth-blind screen snapping — snapToNodes picked the screen-nearest pair, so from a parallel/side view a far box whose features project close on screen could win over a genuinely nearer box. Screen pixels now only gate "is it close enough to consider"; among in-threshold pairs we pick the one closest in 3D world space. 2. Rotated boxes were hard to snap to their top/face — bboxFeatures used Box3.setFromObject (axis-aligned world AABB), whose face centers don't sit on a rotated box's real faces. Now an oriented box (OBB): compute the bbox in the object's local space, then transform the 15 feature points by matrixWorld so corners/face-centers follow rotation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
OBB features + world-distance tiebreak; v0.4 stays partial (sub-stage C Socket system pending). Next: 资源拖拽入视口. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 8, 2026
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 第二个 sub-stage:gizmo 平移拖拽 + 按住 Ctrl/Cmd 时,被拖节点 bbox 特征(中心+8角)吸附到其它节点的对应特征(屏幕 12px 内最近对对齐),命中优先、否则回退 sub-stage A 的网格吸附。
snapToNodes纯函数(src/core/snap/nodes.ts,收已投影屏幕点,可单测)。ThreeViewport:mouseDown 缓存其它节点 bbox 特征(投影屏幕);objectChange 节点吸附优先、grid 回退。mouseUp提交不变(可撤销)。Why
How to test
🤖 Generated with Claude Code