Anchor drawings - #262
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe runtime now passes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/engine/runtime/drawing/drawing_controller/tools.ml (1)
165-181: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winInclude the anchor scale in the eraser proximity calculation.
Line 167 converts
c1to anchor-local coordinates. The stroke paths use the same coordinate space. However, Line 181 passes only the universe scale toclose_enough_poly2.When the anchor scale differs from
1.0, the eraser hit radius is incorrect. Use the same combined scale thatDraw_stroke.startstores for anchored strokes.Proposed fix
let { Universe.Coordinates.scale; _ } = Universe.State.get_coord () in - Drawing_state.Path_editing.close_enough_poly2 scale path c1 + let scale = scale *. translation.scale in + Drawing_state.Path_editing.close_enough_poly2 scale path c1src/engine/runtime/drawing/drawing_controller/setup.ml (1)
128-146: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winDisable editor pointer handlers for unanchored recordings.
The UI displays only the upgrade panel for a non-empty unanchored recording. However,
connectstill mounts the active editing tool over#slipshow-main.
Selection.Preview.eventandMove.Preview.eventthen interpret legacy universe-space paths as anchor-local paths. A pointer action can select or move the wrong strokes before the user upgrades the recording.Read the recording anchor status reactively. Return
Lwd_seq.emptywhile the status isUnanchored.Proposed fix
let handler = let$* status = Status.get - and$ current_tool = Lwd.get Drawing_state.editing_tool in - match status with - | Editing -> ( - let$ replaying_state = Lwd.get current_replaying_state in - match replaying_state with - | None -> Lwd_seq.empty - | Some replaying_state -> ( + and$ current_tool = Lwd.get Drawing_state.editing_tool + and$ replaying_state = Lwd.get current_replaying_state in + match (status, replaying_state) with + | Editing, Some replaying_state -> + let$ anchored = + Lwd.get (snd replaying_state.recording.element_anchor) + in + if anchored = `Unanchored then Lwd_seq.empty + else match current_tool with | Move -> Lwd_seq.element @@ Editing_tools.Move.Preview.event window replaying_state | Select -> Lwd_seq.element @@ Editing_tools.Selection.Preview.event window replaying_state | Rescale -> Lwd_seq.element - @@ Editing_tools.Scale.Preview.event replaying_state)) - | _ -> Lwd.pure Lwd_seq.empty + @@ Editing_tools.Scale.Preview.event replaying_state + | _ -> Lwd.pure Lwd_seq.empty
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 922808c5-bb72-40bc-9ac1-af3da3a68491
📒 Files selected for processing (22)
src/engine/runtime/controller.mlsrc/engine/runtime/drawing/drawing_controller/editing_tools.mlsrc/engine/runtime/drawing/drawing_controller/preview.mlsrc/engine/runtime/drawing/drawing_controller/preview.mlisrc/engine/runtime/drawing/drawing_controller/setup.mlsrc/engine/runtime/drawing/drawing_controller/tools.mlsrc/engine/runtime/drawing/drawing_controller/ui.mlsrc/engine/runtime/drawing/drawing_state/dunesrc/engine/runtime/drawing/drawing_state/json.mlsrc/engine/runtime/drawing/drawing_state/types.mlsrc/engine/runtime/main.mlsrc/engine/runtime/rescale/rescale.csssrc/engine/runtime/step/action_scheduler.mlsrc/engine/runtime/step/actions.mlisrc/engine/runtime/step/actions_.mlsrc/engine/runtime/system.csssrc/engine/runtime/universe/window.mlsrc/engine/runtime/universe/window.mlivendor/github.com/panglesd/brr/src/brr.mlvendor/github.com/panglesd/brr/src/brr.mlivendor/github.com/panglesd/lwd/lib/brr-lwd/elwd.mlvendor/github.com/panglesd/lwd/lib/brr-lwd/elwd.mli
This way, when you add text before, this moves the drawing down, and the drawing stays synchronized with the text.
This changes a bit the workflow for starting drawings: You need first to decide a drawing by including a
.drawfile, then do the drawing and save it.