Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #8256 #8259

Merged
merged 1 commit into from
May 20, 2019
Merged

Fixes #8256 #8259

merged 1 commit into from
May 20, 2019

Conversation

bambielli-flex
Copy link
Contributor

@bambielli-flex bambielli-flex commented May 17, 2019

Launch Checklist

This PR is to fix #8256. By wrapping the movestart event emitter in a check to see if _zooming has already started, it will only fire once.

This affects both movestart and zoomstart, both of which suffered from the problem outlined in the issue.

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs
  • post benchmark scores <-- couldn't get these to run
  • manually test the debug page
  • tagged @mapbox/studio and/or @mapbox/maps-design if this PR includes style spec changes
  • tagged @mapbox/gl-native if this PR includes shader changes or needs a native port

@bambielli-flex
Copy link
Contributor Author

Oops... linting rules workspace collision...

@bambielli-flex
Copy link
Contributor Author

Huh for some reason I can't get the benchmarks to run, even on master... running out of memory.

@bambielli-flex
Copy link
Contributor Author

bambielli-flex commented May 17, 2019

I also tried using sinon's fake timers, but that didn't solve the problem either.

nm it worked

@@ -12,7 +12,8 @@ There are two test suites associated with Mapbox GL JS

To run individual tests:

- Unit tests: `yarn test-unit path/to/file.test.js` where the path begins within the `/test/unit/` directory
- Unit tests: `yarn test-unit path/to/file.test.js` where path *does not include* `test/unit/`
- e.g. `yarn test-unit ui/handler/scroll_zoom.test.js`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this instruction confusing, took me a while to realize that I needed to not include /test/unit/ in the test path to be able to run a test.

@@ -148,5 +149,93 @@ test('ScrollZoomHandler', (t) => {
t.end();
});

t.test('emits one movestart event and one moveend event while zooming', (t) => {
Copy link
Contributor Author

@bambielli-flex bambielli-flex May 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that these tests would fail on master without the scroll_zoom update.

Copy link
Member

@mourner mourner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll let @ryanhamley take a second quick 👀 but this looks great to me! Thanks for the thorough fix with tests.

Copy link
Contributor

@ryanhamley ryanhamley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ryanhamley ryanhamley merged commit fd9cc5d into mapbox:master May 20, 2019
@bambielli-flex bambielli-flex deleted the bambielli/movestart-triggers-once-on-zoom branch May 20, 2019 19:36
pirxpilot pushed a commit to pirxpilot/mapbox-gl-js that referenced this pull request Jun 18, 2019
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.

Map zoom fires "movestart" many times, but "moveend" only once
3 participants