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

Emit a 'radiuschanging' event #76

Open
eddydg opened this issue May 7, 2018 · 3 comments
Open

Emit a 'radiuschanging' event #76

eddydg opened this issue May 7, 2018 · 3 comments

Comments

@eddydg
Copy link
Contributor

eddydg commented May 7, 2018

For a more advanced styling I'd need to keep track of a circle whose radius is being dragged.
Currently we only have 'radiuschanged' which is emitted once the drag has ended. So a 'radiuschanging' could come in handy.

To be consistent, a 'centerchanging' could also be added.

What do you think? would you accept a PR with this feature?

@ghost
Copy link

ghost commented May 27, 2018

@eddydg Do you mean it should fire repeatedly every time we get a rAF slot during animation? Sounds like it would degrade performance (one of our biggest challenges).

@mblomdahl
Copy link
Member

Please put up a pull request if you have a good strategy for adding this feature!

@eddydg
Copy link
Contributor Author

eddydg commented May 28, 2018

Thank you for your answers. I'm not sure what a rAF slot is.
I was thinking about something very (too?) simple: adding

this._eventEmitter.emit('radiuschanging', this); in the set radius and
this._eventEmitter.emit('centerchanging', this); in the set center.

PR: #77

I am not seeing any visible difference in performance but I am keeping a very light playground: http://lab.meltedpeng.com/mapbox-gl-circle/

Edit: Oh ok, rAF for requestAnimationFrame. Never used this abbreviation.
It fires when the center changes, so reacting to the _onRadiusHandlesMouseDown and _onRadiusHandlesMouseMove listeners.

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

No branches or pull requests

2 participants