Skip to content

Commit 77f19db

Browse files
committed
fix: reorder end-node-drag to update model before offset reset
Call node-drag-ended callback before resetting drag offset to ensure the Rust model is updated with final positions before report-rect fires from the property change handlers.
1 parent 5988c8e commit 77f19db

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

node-editor.slint

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,14 +370,16 @@ export component NodeEditor {
370370

371371
/// End node drag
372372
public function end-node-drag(delta-x: length, delta-y: length) {
373-
root.internal-is-dragging = false;
374-
root.internal-drag-offset-x = 0px;
375-
root.internal-drag-offset-y = 0px;
376-
373+
// Call callback FIRST so Rust can update model with correct positions
377374
root.node-drag-ended(
378375
root.grid-snapping ? root.snap-to-grid(delta-x / 1px) : delta-x / 1px,
379376
root.grid-snapping ? root.snap-to-grid(delta-y / 1px) : delta-y / 1px
380377
);
378+
379+
// THEN reset visual offset (now report-rect will find model already updated)
380+
root.internal-is-dragging = false;
381+
root.internal-drag-offset-x = 0px;
382+
root.internal-drag-offset-y = 0px;
381383
}
382384

383385
// === Trigger updates on viewport changes ===

0 commit comments

Comments
 (0)