Git Product home page Git Product logo

Comments (9)

tempranova avatar tempranova commented on September 16, 2024 1

I think I'll be able to do it. More coming in the next day or so again!

from mapbox-gl-draw-rotate-mode.

tempranova avatar tempranova commented on September 16, 2024

This sounds fun! I will put this on my list to try to make an event available. I'm surprised the changemode listener doesn't do it, but maybe I need to cause something to ping.

I will also add a "start rotate", "rotating" and "endrotate", à la GL Draw. Coming in the next couple days!

from mapbox-gl-draw-rotate-mode.

shawnmgoulet avatar shawnmgoulet commented on September 16, 2024

Glad you're excited about the use case!

I would love to figure out how to add the 3 listeners 'startrotate', 'rotating', 'endrotate' to contribute to your package and not need you to do that work, but I've been unsuccessful at that thus far.

I'm going to test around with the changeMode listener again today, but I wasn't able to get it to work for me yesterday.

from mapbox-gl-draw-rotate-mode.

shawnmgoulet avatar shawnmgoulet commented on September 16, 2024

It looks like, this from mapbox-gl-draw/API.md#events might be why draw.modechange isn't working:

For example, if you have a one feature selected and then invoke draw.changeMode('draw_polygon'), you will not see a draw.modechange event (because that directly corresponds with the invoked function) but you will see a draw.selectionchange event, since by changing the mode you indirectly deselected a feature.

AND

from mapbox-gl-draw/API.md#drawmodechange, if I understand correctly, none of the interactions would apply moving between 'RotateMode' & 'simple_select' mode, only between 'simple_select' & 'direct_select'.

from mapbox-gl-draw-rotate-mode.

tempranova avatar tempranova commented on September 16, 2024
  • Yeah, it looks like "modechange" doesn't apply to the mode changing really, it's just what they called it but it's not really that accurate to what it does.
  • I've added some events! It was fun. Check out the revised documentation. The features and current center, etc, are available in the events. I'm not 100% sure it's bug free, though!

http://mapster.me/mapbox-gl-draw-rotate-mode/

from mapbox-gl-draw-rotate-mode.

shawnmgoulet avatar shawnmgoulet commented on September 16, 2024

COOL! This is awesome.

I'm currently playing around with it.

I'm not yet sure if I'm able to do what my use case needs. For my use case, the 'rotateend' event, needs to be emitted from the Mapbox GL JS map object so that I'm able to do things like change the styling/do math with intersecting map features with the selected draw instance a la:

map.on('draw.update', function (e) {
// HIGHLIGHT INTERSECTING MAP FEATURE POLYGONS
// DO MATH USING MAP FEATURE POLYGONS' PROPERTY/VALUE PAIRS
// SO ON & SO FORTH
});

So for the RotateEnd, I believe I'd need to do something like:

map.on(RotateMode.rotateend = function(selectedFeature) {
// OR
map.on('RotateMode.rotateend', function (e) {
}

I've been unsuccessful thus far, unless this is impossible to do currently...

from mapbox-gl-draw-rotate-mode.

tempranova avatar tempranova commented on September 16, 2024

I don't really understand why you can't access the map object, or access the draw object, inside the event handler that I've created? Is there a particular reason why it needs to be emitted from the map object? You can use draw methods to get the currently selected item, or match the geoJSON from my event to a geoJSON on the map, do any styling you want, etc. All the IDs are available from the objects from my event handler.

from mapbox-gl-draw-rotate-mode.

shawnmgoulet avatar shawnmgoulet commented on September 16, 2024

Hey @tempranova. Apologies for the radio silence. Being a new/first time dad, I turned off everything over the past few weeks outside of the baby & family.

Thank you for your reply. I'm starting to jump back into this. I'm guessing I hadn't gotten to the point of understanding & executing what you describe above when I last posted. I will now work on this to see what I can get going.

from mapbox-gl-draw-rotate-mode.

tempranova avatar tempranova commented on September 16, 2024

OK, sure -- just let me know if it doesn't seem to work. Feel free to post a code sample too.

from mapbox-gl-draw-rotate-mode.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.