mapbox / mapbox/mapbox-gl-compare

Slider position was wrong with mouse moving after the "margin-left" css of map was added

Open
#37 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
152
Forks
43
PR merge metrics
No merged PRs in 30d

Description

I tried to add the two maps with comparison inside a DIV. It worked in the beginning. But after adding the "margin-left" css to the DIV and expending the width of the maps, the slider position was wrong with mouse moving. There was an offset between the mouse position and the slider. The offset value is just the value of "margin-left". Do you have any thoughts to fix the issue? Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with two maps inside a DIV, adding margin-left and expanding the map width as described. Trace the slider's mouse-position calculation and verify that the slider stays aligned with the pointer when the container has a left margin.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.