Skip to content

Emit a 'radiuschanging' event #76

Description

@eddydg

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?

Activity

  1. mblomdahl commented on May 27, 2018

    @mblomdahl
    Contributor

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

  2. eddydg commented on May 28, 2018

    @eddydg
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions