Skip to content

Bugfix: use a consistent coordinate space for CustomSlider drag#460

Open
omargfh wants to merge 1 commit into
mainfrom
bugfix/slider-drag-basis
Open

Bugfix: use a consistent coordinate space for CustomSlider drag#460
omargfh wants to merge 1 commit into
mainfrom
bugfix/slider-drag-basis

Conversation

@omargfh

@omargfh omargfh commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Issue

Sliders calculate click position incorrectly when NetLogo Web simulation runtime overflows. This issue requires the iframe itself to overflow, which does not happen on the www.netlogoweb.org/launch but happens on www.netlogoweb.org/web.

Diagnosis

The function getClientPosition in ReactiveCustomSlider uses viewport-space coordinates while getSliderStart and getSliderLength use document-space coordinates. Due to how www.netlogoweb.org/launch embeds the runtime simulation, those coordinate-spaces share the same basis and offset. This is not the case on beta.modelingcommons.org or when running www.netlogoweb.org/web in its own tab.

Recreate

  1. Open a model in www.netlogoweb.org/web
  2. Go into authoring mode
  3. Add a slider and push it outside of the window bounds
  4. Return to interactive mode
  5. Scroll until you find the new slider
  6. Click or drag along the slider

Expected behavior: slider snaps to mouse position on click and follows mouse on drag
Actual behavior: slider snaps to incorrect position, often at the extremes or by some noticeable offset from the mouse position

Fix

Convert getClientPosition to document-space coordinates by adding the window scroll to its returned value.

Closes #459

@omargfh omargfh requested a review from LaCuneta June 29, 2026 20:11
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.

Incorrect slider behavior on click/drag when simulation container overflows

1 participant