Avoid moving the map with Overlays - openlayers-3

Do you know how to avoid panning the map view when showing overlays with OpenLayers 3? I have a popup objects, displaying with hovers or click events. But I'd like to aovid the whole view to move, that can be quite disturbing with many "hover" popups which move the map to show this object...
I guess that will be with the change:position event of ol.Overlay, but what's the function to "block view pan" in this case ?

Related

How to add an clickable button on top of a MapView in Delphi FireMonkey?

I need to add a clickable button with a custom image on top of the TMapView, is this possible?
ps: even if I leave the TImage on top of the view, the map overlays it, that is, the button appears quickly until the map rendering overlays it...
edit ps2: There is no code for the example, I simply put a TImage on the Form, either as a child of TMapView, or as a child of TForm, when I test it on android, when opening the app the image appears quickly before the map and then when the map starts to appear it overlays the image...
edit ps3: I don't know if a TImage is the correct way to do this, is this any component to leave on top of the map, that keeps showing up, serving as a button? Just like on Google Maps...
You can't show anything on TMapView because of "z-order" problem. I looked for while to find a solution.
See : Delphi object over TMapView

OL3 - Draw rectangle using single drag movement

I'm looking for a way to draw a rectangle in a single drag movement, so the user click and hold the mouse pressed then move the mouse and the rectangle is painting as he go and the drawing is finished when he stop pressing the mouse.
Currently it's done using mouse click -> drag -> mouse click again to finish, not that intuitive.
I'm using the latest OpenLayers 3.
Thanks!
The functionality asked for is already present in latest openlayers version (v3.19). Use ol.interaction.Draw.createBox() to create a rectangle with 2 clicks one for start and another for end. See the below example for more details
http://openlayers.org/en/latest/examples/draw-shapes.html?q=draw
You can create your style for the rectangle by creating style object and declaring it in ol.interaction.Draw().
Instead of using the built-in interaction use an instance of https://github.com/openlayers/ol3/blob/master/src/ol/interaction/dragzoom.js but pass in an option/condition to not use the shift key. Here are the conditions https://github.com/openlayers/ol3/blob/master/src/ol/events/condition.js
Have you looked into the DragBox interaction? This will give the user an outline of the box as they are drawing it with click, drag, and release being the interaction.

Openlayers 3 map initially only draws on window resize

I have a popup window that comes up when you click on a map marker. Within the popup window there is a minimap that shows the point that was clicked on, but zoomed in, so a thumbnail of that point on the ground. This minimap is an innerHTML element in the popup window. When I first click on the marker, this map element is blank, but when I resize my browser window the map appears. Also when I click on a different marker, the map will appear if I don't close the popup. The map just does not show up when the popup initially appears unless I resize the browser. Does anyone know what could be the issue? Thanks!
I've had this issue in the past - on window resizes. I tend to trigger a resize to force it when starting.
Try calling map.getMap().updateSize(); after you setup the map in the popup?

How to use TFramedScrollBox correctly with Touchscrolling, if there are Buttons inside?

I have derived a TFramedScrollBox to implement in my component a class which constructs me on a given dimension (x and y) buttons onto the FramedScrollBox. This works fine. Touchscrolling on this object works fine, if the property Touch.Pan is set to true. Then i even can scroll over the buttons and by "touching" or "tapping" the buttons the click event happens right after the touch. This derived component, my component, is used all over the application, because it need to be.
The Problem(s)
The given app is running in fullscreen mode on win 8 systems which is currently necessary for our business. In the above explained situation is not possible to tap the buttons fast after the others, because some click events don't rises. And the logic behind is not necessary. That is one problem... If I switch the form to none fullscreenmode then a touch on different buttons rises the click event immediatly as wished. Now i have discovered that if the above mentioned property Pan is set to false, then even on fullsceenmode every touch click rises the event but now the scrollbox don't scrolls by touch gesture...
Now comes my question in the title...
Ps. if wished i can send a simple sample...

How to delete a polygon on map

I implemented a map using apple's native f/w and I have implemented the functionality to add some polygons over the map. Now, I want to have a "close" button at the edge of the each polygon and when I click on that button, i need to delete the polygon (one polygon at a time). I have tried creating a button over the polygon edge, but I was unable to make an action on clicking the button. I have tried with annotations as well. In this case, I am unable create a close button over all the polygons; I could able to have the close button (annotation) only on the last polygon which was created but when I click on the button, the polygon which was created first only was getting deleted.
Kindly suggest me a solution to have a close button on each polygon, and to delete a polygon(one by one) on clicking the button.

Resources