Skip to content

fix(ui): on a touch screen, a swipe over the model builder's tools scrolls them (#3034) - #3049

Merged
jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:fix/3034-palette-touch-swipe
Nov 26, 2026
Merged

jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:fix/3034-palette-touch-swipe

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On a touch screen, a swipe that starts on a row of the model builder's tool list now scrolls the list. It used to take the tool under the finger and drag it, because each row senses a drag inside a scroll area (palette_ui, modelbuilder.rs).

  • A tap still adds the tool.
  • A finger held on a tool and then moved carries it to the canvas, where letting go drops it. A long press without a move adds nothing.
  • The mouse drags a tool at once, as before. A drag with the secondary button no longer picks a tool up, as in the lists changed by feat(ui): on a touch screen, tabs and rows reorder only after a long press (#2958) #3032.
  • + Input and + Output are unchanged: they sit above the list, where nothing scrolls.

This reaches the desktop and web interface, where the model builder lives; no command, undo step or saved format changes.

The rows use the three helpers #3032 added for the lists that reorder (reorder_sense, reorder_drag, yield_touch_drag in widgets.rs). The name following the pointer is now drawn while the drag payload is the row's, not while resp.dragged(): after a long press egui has let go of the row's own drag. The helpers keep their names; renaming them would touch every caller for no change in behaviour.

Testing

New tests in modelbuilder.rs, with the touch events as winit reports them:

  • a_swipe_over_the_palette_scrolls_and_adds_no_tool (failed before: the swipe dropped Buffer on the canvas)
  • a_long_press_then_a_move_drops_a_tool_on_the_canvas (failed before: nothing was dropped; also checks that a long press alone adds nothing, that the list stays still while the tool is carried, that a secondary-button drag adds nothing, and that the drop lands where a mouse drag lands)
  • a_tap_on_a_palette_tool_adds_it (passes before and after)
  • the_input_and_output_buttons_drag_onto_the_canvas (mouse and finger, with the name following the pointer; fails if the buttons start no drag)

The touch and mouse drag helpers of the panes.rs tests are now pub(crate) so these tests share them.

Not tried on a device.

UI evidence

No visible UI change.

Related issue

Closes #3034

Summary by CodeRabbit

  • New Features
    • Improved touch interactions in the tool palette: swipe to scroll without adding a tool, tap to add tools, and long-press to drag tools onto the canvas.
    • Palette items, including input and output controls, now support more reliable dragging while keeping touch scrolling responsive.
  • Bug Fixes
    • Prevented secondary-button drags from adding or moving tools.

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The model-builder palette now supports touch scrolling without starting a tool drag on a swipe. Tool dragging uses explicit drag-start signals and supports long presses. New tests cover scrolling, adding tools, and drag behavior.

Changes: Model-builder palette touch and drag behavior

Layer / File(s) Summary
Palette scrolling and drag handling
crates/ui-egui/src/modelbuilder.rs
Input and output controls and tool rows pass explicit drag-start signals to drag_source. The palette yields touch-drag ownership to its scroll area. Drag previews appear while the matching payload exists.
Palette interaction tests
crates/ui-egui/src/modelbuilder.rs, crates/ui-egui/src/panes.rs
Tests cover swipe scrolling, tap-to-add, long-press dragging, canvas drops, and secondary-button rejection. The test module and shared drag helpers are crate-visible.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related issues

  • opengeos/RustGIS#2958: This issue describes the same touch-scroll versus drag conflict for tabs, Browser rows, and Layers rows. This PR changes the model-builder palette, not those other widgets.

Suggested reviewers: giswqs

Merge Risk: Minimal · up to 94e19

This change lets a finger swipe on a model-builder tool row scroll the list instead of dragging the tool, while taps still add a tool and long-press drags still work. No concrete merge-blocking risk was identified. Real-device testing has not been done.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a touch swipe over the model builder's tools now scrolls the list instead of dragging a tool. It matches the linked issue #3034 and the description. The title is one s…
Description check Passed The description follows the template sections: Summary, Testing, UI evidence, and Related issue. The Summary explains the touch-scroll change and the affected helpers. Testing lists new tests and loca…
Linked Issues check Passed [#3034] requires three behaviours in the model builder palette: (1) a touch swipe that starts on a tool row scrolls the list; (2) a tap adds the tool; (3) a tool is dragged only after a long press. Th…
Out of Scope Changes check Passed All modelbuilder.rs changes serve #3034. The palette sensing, drag start, yield_touch_drag call and drag_source change implement the palette fix. The drag_source change also applies to the + Input and…
Full details: Title check

Explanation

The title names the main change: a touch swipe over the model builder's tools now scrolls the list instead of dragging a tool. It matches the linked issue #3034 and the description. The title is one sentence, but it is long at 87 characters, and it uses a conventional fix(ui) prefix.

Full details: Description check

Explanation

The description follows the template sections: Summary, Testing, UI evidence, and Related issue. The Summary explains the touch-scroll change and the affected helpers. Testing lists new tests and local run results. UI evidence states 'No visible UI change.' as the template requires. Related issue reads 'Closes #3034'. The description is complete and specific.

Full details: Linked Issues check

Explanation

[#3034] requires three behaviours in the model builder palette: (1) a touch swipe that starts on a tool row scrolls the list; (2) a tap adds the tool; (3) a tool is dragged only after a long press. The whole-PR diff of crates/ui-egui/src/modelbuilder.rs implements these. Tool rows now allocate with crate::widgets::reorder_sense(ui, true). Their drag start comes from crate::widgets::reorder_drag(ui, &resp, true). The palette calls crate::widgets::yield_touch_drag on the mb_palette ScrollArea id, so the list owns the touch swipe. drag_source now takes the start signal, and it draws the ghost while the payload matches the item. The new tests cover the swipe (a_swipe_over_the_palette_scrolls_and_adds_no_tool), the tap (a_tap_on_a_palette_tool_adds_it), and the long press, carry, secondary-button rejection and canvas drop (a_long_press_then_a_move_drops_a_tool_on_the_canvas). The Input and Output buttons are covered by the_input_and_output_buttons_drag_onto_the_canvas. The helpers reorder_sense, reorder_drag and yield_touch_drag are not changed by this PR's diff of modelbuilder.rs; the PR states they come from #3032. The tests were not executed in this review, so their results rest on the author's report.

Full details: Out of Scope Changes check

Explanation

All modelbuilder.rs changes serve #3034. The palette sensing, drag start, yield_touch_drag call and drag_source change implement the palette fix. The drag_source change also applies to the + Input and + Output buttons. For those buttons it passes resp.drag_started(), so they keep their start-time behaviour and are not changed in effect. The ghost rule now checks the drag payload. This is needed for the long-press case described in the code comment. The new tests cover the issue behaviour. The panes.rs change only makes the tests module and the drag_layer and touch_drag helpers pub(crate), so modelbuilder tests can reuse them. No unrelated change was found. The panes.rs diff was not re-read in this review; its scope rests on the supplied summary, which lists visibility changes only.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

A rabbit taps the tool-row beat,
Then swipes; the list glides smooth and neat.
A long-held paw begins a tow,
The tool previews as it goes.
On canvas, input and output land,
The rabbit celebrates, paws in hand.<!-- fixed_issue_severity --> <fixed_issue_severity>Medium</fixed_issue_severity>

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 526f5862-bbf6-483d-b0b8-f0d72a59a215
Commits

Reviewing files that changed from the base of the PR and between 80faa28 and 94e1986.

Files selected for processing: 1

  • crates/ui-egui/src/modelbuilder.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment thread crates/ui-egui/src/modelbuilder.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read the full diff (two files, about 100 added and 12 removed lines), the helpers it relies on in widgets.rs (reorder_sense, reorder_drag, yield_touch_drag), the drop handler at modelbuilder.rs:1188 (bg.dnd_release_payload::<Add>()), and the repository guidelines. The prior-review file has no threads, so there were no earlier concerns to skip.

I found no bugs, security issues or performance problems. The touch flow is consistent with the helpers from #3032 and with the mapview.rs tab-drag code that uses the same pattern. The new tests cover the stated cases: swipe scrolls without adding, tap adds, long press without a move adds nothing, a moved long press drops at the same place as a mouse drag, and a secondary-button drag adds nothing. I did not run the tests, because I have no shell in this session.

Bugs: none found.

Security: none found.

Performance: none found.

Quality:

  • + Input and + Output now call drag_source with resp.drag_started() and draw the ghost label from the payload instead of resp.dragged(). The behaviour is nearly identical, but no test drags these two buttons, so nothing pins it. Inline comment posted at modelbuilder.rs:768. Confidence: medium.

AGENTS.md: no rule breaks found. Both new helpers are shared, not desktop-only, so the wasm build is unaffected. No commands, saved formats or assets change. Layering is unchanged. The PR states that the phone interface (ui-touch) does not show the model builder, which matches what I found in that crate.

Surfaces: the change reaches the desktop and web model builder. It has no command, ribbon, Assistant or MCP surface, so there is nothing to undo or document there.

Confidence overall: high that the diff is correct as written. The main unverified point is that egui clears the drag payload on release, which the existing drop code already relies on.

Change size

Compared with the base branch: the whole PR against main (merge base f1cb392 to PR head 80faa28).

Measure Value
Files changed 2 (0 added, 2 modified, 0 removed, 0 renamed)
Size before 592.6 KB
Size after 597.3 KB
Total size change +4.7 KB
Path Before After Change
crates/ui-egui/src/modelbuilder.rs 88.0 KB 92.6 KB +4.6 KB
crates/ui-egui/src/panes.rs 504.7 KB 504.8 KB +33 B

@jgregoriorincon
jgregoriorincon marked this pull request as draft November 26, 2026 21:10
@github-actions

Copy link
Copy Markdown
Contributor

Code review

Findings for PR #3049 (touch swipe over the model builder's tool palette). I read the full diff, the helpers in widgets.rs, the drop handling at modelbuilder.rs:1188, and the prior review threads.

Bugs: None found. I traced the payload path (drag_source sets and checks DragAndDrop payload, dnd_release_payload consumes it on release) and the long-press arm logic in reorder_drag. Both look correct, and the new tests cover the touch, mouse, and secondary-button paths. Confidence: moderate-high. I did not run the tests, since I have no shell here.

Security: None. The change is UI-only and adds no parsing or I/O.

Performance: None. drag_source now performs one payload type-check per row per frame, the same cost as the old dragged() check.

Quality:

  • panes.rs:207 (inline, nit): the model builder tests now depend on panes::tests helpers (touch_drag, drag_layer), which had to be made pub(crate). Moving them into a shared test-support module would decouple them. Confidence: high that it is a nit, not a defect.

AGENTS.md: No rule breaks found. Checked:

  • tl! is used for the new user-visible text.
  • No unwrap is added to non-test code. The new tests use unwrap only through existing helpers.
  • The change is UI-only, so no command, schema, or memory limits are affected.
  • The desktop/web surface statement in the PR body is adequate.
  • Test hygiene holds: no identical assert_eq! sides, no timer waits.

Twins checked:

  • The other callers of reorder_drag, reorder_sense and yield_touch_drag (mapview.rs, panes.rs, widgets.rs:1065) use the same helpers unchanged, so the PR does not need to change them.
  • drag_source is used only in modelbuilder.rs, so there is no second palette to keep in step.
  • The PR touches no #[cfg(target_arch = "wasm32")] branch.

Prior reviews: The two threads on prior-reviews.json are both resolved. The first asked for a test covering + Input and + Output drags, and the author added the_input_and_output_buttons_drag_onto_the_canvas, which covers that concern. I left it alone. No other concerns were already raised, so none were repeated.

Change size

Compared with main (merge base f1cb392 to PR head 94e1986). Sizes are file sizes, not line counts.

Measure Value
Files changed 2 (0 added, 2 modified, 0 removed, 0 renamed)
Size before 592.7 KB
Size after 599.1 KB
Total size change +6.5 KB
Path Before After Change
crates/ui-egui/src/modelbuilder.rs 88.0 KB 94.4 KB +6.4 KB
crates/ui-egui/src/panes.rs 504.7 KB 504.7 KB +33 B

@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

On the test helpers: leaving touch_drag and drag_layer in panes::tests. They are two helpers shared with one other module, and moving them into a test-support module changes no behaviour or coverage.

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3049/
Web app https://preview.rustgis.app/pr-3049/app/
Commit 94e1986

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@jgregoriorincon
jgregoriorincon marked this pull request as ready for review November 26, 2026 21:31
@github-actions

Copy link
Copy Markdown
Contributor

Code review

Reviewed the 2-file diff (modelbuilder.rs, panes.rs), read widgets.rs for the reorder_sense, reorder_drag and yield_touch_drag helpers it relies on, and checked the drop side in modelbuilder.rs (dnd_release_payload, around line 1188). I did not run the build or tests; I have no shell here.

Bugs: none found. I checked these paths and they look correct:

  • Mouse drags still start on the primary button. A secondary-button drag does not start one, so it adds nothing.
  • A finger on a tool row sets Sense::click() only, so the palette's scroll area takes a swipe. A long press arms the row, and the payload is set once, on the first frame of movement past 8 px.
  • + Input and + Output sit outside the scroll area and keep click_and_drag, so they drag at once. The ghost check uses the payload rather than resp.dragged(), so it still works after a long press has released the row's own drag.
  • Drop on the canvas is unchanged and reads the same payload type.

Security: none. The change is UI-only and touches no input parsing, commands, files or saved formats.

Performance: none. The payload check runs once per visible row per frame, which is negligible.

Quality:

  • panes::tests is now pub(crate) only so modelbuilder.rs can reuse touch_drag and drag_layer. That exposes the whole test module. I posted an inline nit suggesting a small shared test-support module instead (confidence: high that it's a nit).
  • Low confidence, not posted: the ghost is now drawn for every row whose tool id equals the payload, where before only the dragged row drew it. This only matters if two palette rows share a tool id, which I did not verify.

AGENTS.md: no breaks found.

  • Desktop and web are covered by the change. The phone interface (ui-touch) was not addressed; the PR body says the model builder only reaches desktop and web, and I did not check whether ui-touch uses it.
  • No command ids, parameters or saved formats change, so command-surface.txt and the schema need no update.
  • The new tests use no timer waits and no assert_eq! with identical sides.

Twins checked:

Prior reviews: there was one thread, a quality concern that + Input and + Output lacked a drag test. The author replied and added the_input_and_output_buttons_drag_onto_the_canvas, which covers both buttons with the mouse and with a finger. The thread is resolved and I left it alone. I raised no concern already raised there.

Change size

Compared with the base branch: the whole PR against main (merge base f1cb392 to PR head 94e1986).

Measure Value
Files changed 2 (0 added, 2 modified, 0 removed, 0 renamed)
Size before 592.7 KB
Size after 599.1 KB
Total size change +6.5 KB
Path Before After Change
crates/ui-egui/src/modelbuilder.rs 88.0 KB 94.4 KB +6.4 KB
crates/ui-egui/src/panes.rs 504.7 KB 504.7 KB +33 B

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 26, 2026
@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

On the two summary points: the shared test-support module is answered above. On rows sharing a tool id: they would paint the label at the same pointer position, and a drop carries only the id, so nothing changes.

Merged via the queue into opengeos:main with commit 6bb1d6e Nov 26, 2026
31 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3034-palette-touch-swipe branch November 26, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: On a touch screen, a swipe over the model builder's tool list drags a tool instead of scrolling

1 participant