Can I configure Mapbox GL JS to do the dragRotate behavior without the shift key? - mapbox-gl-js

I'd like to make a map that is fixed on a specific point (options.dragPan=false), but allows the user to rotate and pitch the map with their mouse. I can ask users to hold the ctrl key down while they drag the mouse (or use the right mouse button), but I'd prefer to configure the map such that the shift key is unnecessary.
Is there a good way to hijack the mousemove event to achieve this? Maybe modify e.ctrlKey before it propogates to the mapbox handler?
For reference: the DragRotateHandler class

Related

React leaflet adding layer that covers whole map and accepts leaflet mouse events

I have many markers on map with event listeners added to them. I also have a control on map that enables placing other shapes (circles) when map is clicked in the position of a click. The problem now is that clicking on position on the map where marker placed when control is enabled also triggers marker click event. Is there a solution in react-leaflet to add some pane on top of all other panes and layers so events are triggered only on that pane. The key thing here is that pane itself does not have leaflet event handlers, hence can not pass latLng to event callback. It only provides DOM mouseEvent but not LeafletMouseEvent that I need.

Leaflet map contextmenu position

In leaflet map, on mouse right click, context menu is display right side to the cursor on map. Now our application is made compatible with right to left layout (for arabic). We need to display the context menu left side to the cursor now. We are using "leaft-contextmenu". Is there any simple way to achieve this?

NSButton in Swift, handle click and release events

i'm trying to manage different state of a simple push button on an OS X application : When the user click on it, and when the user release the click.
Currently i set my button type by NSMomentaryLightButton
NSMomentaryLightButton When the button is clicked (on state), it
appears illuminated. If the button has borders, it may also appear
recessed. When the button is released, it returns to its normal (off)
state.
This type of button is best for simply triggering actions because it
doesn’t show its state; it always displays its normal image or title.
This option is called Momentary Light in Interface Builder’s Button
inspector
I thought it was the good way, but when i print my button status, it's like a toggle button than the push button that i set. As you can see on exemple gif
To sum up, How can i have a real push button behaviour ? Call function when the user click on it, and when the user release the click.
Thank,
You don't want to use buttons for piano keys. First, they are non-rectangular, and they don't act as buttons do: neither single-action push-button, nor toggle switches. You are interacting in a custom way, with a custom view, meaning the NSButton control hierarchy isn't called for. Instead you're subclassing NSView and capturing low-level mouse events as detailed here:
https://developer.apple.com/library/prerelease/content/documentation/Cocoa/Conceptual/EventOverview/HandlingMouseEvents/HandlingMouseEvents.html#//apple_ref/doc/uid/10000060i-CH6-SW1
You found this yourself as you detailed in your own comments, but I wanted to make sure you had a higher level point of view. It's even possible, and probably best, to consolidate all of the piano keys into a single view, and let the keys themselves be rendered using NSBezierPath and perform mouse hit detection using containsPoint:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSBezierPath_Class/#//apple_ref/occ/instm/NSBezierPath/containsPoint:
This is a lot more work but the only way to make a truly professional looking piano simulation. Then you can render the keys with whatever outline, fill, and labeling you need without the limitations of built-in button shapes and layout. You could even have the bottom edges of the keys slightly rounded, for example, or apply a shiny texture.

Leafet.js: add button with link to zoombox function

I need to add a control button with a "rectangle" zoom or what's called the boxZoom function in leaflet. I know that the function can be used when pressing shift and drawing a rectangle but I need a button that gets clicked and then the user can draw a rectangle which is used a bounds for the boxZoom function. I thought this wouldn't be difficult but I just can't figure it out.
Bonus points if you could tell me how to link other functions, e.g. of leaflet.draw, to my own buttons. I need to create my own button toolbar, so I need to be able to attach different functions to the buttons and would like to use already existing functions.
There isn't a one size fits all solution for this (thus the reason for L.Control.BoxZoom being its own plugin). You'll need to add buttons with click handlers, then read the API of Leaflet or the plugin you're integrating with (e.g. drawing) to find how to toggle the behavior.
The Leaflet.EasyButton plugin does a good job of encapsulating the creation of single button controls and click handlers in an easy way, and may be a good starting point if you're struggling with getting started.

How to remove the callout from the popup, bubble or cloud?

I am switching from Google Maps to Open Street Map and starting to work with the API. From the code examples, I could not find one with custom popups. How do I remove the ugly arrow or callout that points the bubble to the marker?
Use OpenLayers.Popup.Anchored or modify popup style.