Disable mouse wheel zoom in Mapbox maps? - maps

How can I disable mouse wheel zoom on Mapbox maps?
I am trying to create a simple map, as per the simple example:
mapbox.auto('map', 'examples.map-vyofok3q');
The Mapbox docs say that you can supply an extra eventhandler argument when you create the map, including the MM.MouseWheelHandler() event, but they do not example how to actually provide a handler:
eventHandlers can be an array of event handlers, including any of the following:
.... MM.MouseWheelHandler()
Please could someone give an example of how to use this handler to disable mouse wheel zoom?

For Mapbox GL JS maps
map.scrollZoom.disable();

(this is a double with a support forum question, but I'll write it here as well)-> http://bl.ocks.org/4404508

Related

D3 zoom and pan zooming independently on mouse and programmatically

Could some kind and clever D3 soul please put me out of my misery. I have the following example setup - https://codesandbox.io/s/compassionate-night-kpqc8t?file=/src/App.js. There are zoom buttons and the svg takes mouse events to initiate zoom. Problem is that the zoom triggered by the button is independent of that triggered by the button.
I believe this stackOverflow describes the problem and the solution - D3.zoom jumps when using mouse wheel after programmatically zoom - I just cannot figure out the implementation for the life of me in the context I have.
I got it to work. I'm not entirely sure what the difference is, but somewhere along the line I must've been targeting the wrong element...
At the bottom of this article - https://www.d3indepth.com/zoom-and-pan/ - is an example codepen. Following the codepen to the letter resolved my issue.
Thanks,
Simon

How to detect two animated objects intersection in reanimated 2?

I'm having an animated object, that can zoom, drag and rotate. What is the best way to detect its collision with other object or border? What I tried so far:
onLayout doesn't fire on reanimated events.
useAnimatedReaction crashes on attempts to use references (created with either useRef or useAnimatedRef) inside of it, thus cannot use .measure, .measureLayout or reanimated measure inside of it.
useEffect (with dependencies of zoom, rotate and drag shared values) doesn't fire until the gesture is done. Value created with useDerivedValue doesn't help in this case either.
Here is the sample project:
https://github.com/topheroes/TestReanimatedIntersection
Please advice

Generate fake ManipulationDeltaEventArgs in WPF?

Is it possible to generate fake ManipulationDeltaEventArgs? I have a touch app which allows users to pinch and zoom images. This works fine, but I'd like them to be able to zoom with buttons instead of pinch and zoom.
Since I have my working code using OnManipulationDelta, is there any way to map scaling using buttons to produce the ManipulationDeltaEventArgs programmatically? I'd then set the scale manipulation to what I want. It doesn't seem to be possible to do this directly but maybe there's some workaround?
Thanks
The correct way would be to create a method that contains the zooming code and call this method from the button click and from OnManipulationDelta.

Silverlight MapLayer right click issue

I am currently developing a Silverlight OOB application using the Bing Map Control, however I have come across an issue I am struggling to resolve. Basically I have three map layers:-
Base Map (bottom layer)
Icon / Pushpin layer (middle layer)
Shape / drawing layer (top layer)
This all works fine, I have put mouse right click functionality on each of my icons (pushpins if you prefer), if I add a map polygon or polyline to the top layer and this item happens to cover the same area as one of my icons in the middle layer I can no longer get any of the mouse events to fire on my icon.
If anyone can think of a way I can pass the mouse operations from my top layer objects to the middle layer objects please let me know.
Many thanks in advance
Set the IsHitTestVisible of your top layer to false. I feel I need to type more text here but there really isn't much more to say.
It's not clear from your question if you need both the shape and the icon to get the mouse event.
If all you need is for the icon to get the event, then switch the order of your layers so Icon layer is on top.
If you need both shape and icon to get the event, then (if you keep your order with shapes on top) you would need to have some way to tell what icons a shape covers. Do you have a parent/child releationship between them? If not, can you create one? If you set up an event on the shape, and set up OnEvent handlers for the icons that listen to the events, then you can have the icons react as well.
If you are more clear about what your situation is, I could post some code that could help.

mouse events in JfreeChart

I need a way to distinguish when a mouse event occurs in the chart itself and not in the chartPanel (the plot area).
Thanks
You should be able to use the mouse event from your panel and use ChartMouseEvent.getEntity() to find if your chart is over one of the chart entities. See the api docs for ChartMouseEvent.

Resources