Skip to content

Incorrect slider behavior on click/drag when simulation container overflows #459

Description

@omargfh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions