0

I am new here, so I hope I am doing it right. I have a similar question as Drag issue on an OpenLayers map inside a jquery ui draggable div

But I need to go a step further. I have created a setup with kolor PTP, with an OSM (mapstraction) map inside a window (about 400x700px) on top of the whole viewer (which is the whole screen). I have enabled dragging on this mapwindow, no problem. I have also created a 'click' event for the map to get coordinates, no problem. As long as I don't drag the mapwindow, it works perfectly. But if I drag this mapwindow to the other side of my screen and try to get coordinates, it gets the wrong coordinates. Like that the map is created on top of the whole screen and you can only see the part inside the mapwindow. If you drag this mapwindow, and click inside the mapwindow, it converts the new mouse coordinates to a LatLon as if the map hasn't moved at all. But it did, if I drag the mapwindow, the map gets dragged along nicely.

I have tried to capture everything in DIVs and set draggable on and off for some parts, but to no avail.

Anybody?

  • Can you give examples of what you've tried. – nmtoken Aug 23 '16 at 16:40
  • The problem is that it is all so deeply nested. But basically, there is a mapDiv inside a predefined DIV. This mapDiv gets allocated and filled on maprequest, filling it with markers and other stuff from XML. I have created a button inside (but also tested outside) this mapDiv which starts a function on mouseover to set the mapWindow div draggable while setting the map notdraggable (otherwise the other maplayer GMaps would drag along like mentioned other thread). I have tried all variations of setting these DIVs not or yes draggable.. This setting draggable works for movements, but not coords? – LMB Aug 23 '16 at 17:58
  • I am getting closer; I am now displaying mouse coordinates. If I call the map for the first time, lefttop is nicely 0/0, but if I drag the mapwindow to the right, the mouse coordinates enlarge accordingly, whereas I would like them to stay the same of course. Just to be clear, moving the mapwindow 500px to the right, would give a lefttop of 500/0... – LMB Aug 23 '16 at 18:20
-1

Well, i solved it myself, by refreshing the mapDiv (forceResizeMapLayer)

Earlier comments: The problem is that it is all so deeply nested. But basically, there is a mapDiv inside a predefined DIV. This mapDiv gets allocated and filled on maprequest, filling it with markers and other stuff from XML. I have created a button inside (but also tested outside) this mapDiv which starts a function on mouseover to set the mapWindow div draggable while setting the map notdraggable (otherwise the other maplayer GMaps would drag along like mentioned other thread). I have tried all variations of setting these DIVs not or yes draggable.. This setting draggable works for movements, but not coords? – LMB Aug 23 at 17:58

I am getting closer; I am now displaying mouse coordinates. If I call the map for the first time, lefttop is nicely 0/0, but if I drag the mapwindow to the right, the mouse coordinates enlarge accordingly, whereas I would like them to stay the same of course. Just to be clear, moving the mapwindow 500px to the right, would give a lefttop of 500/0... – LMB Aug 23 at 18:20

  • 3
    Could you roll up all your comments and add them together as an answer. This will help others with the same question in the future. – nmtoken Aug 25 '16 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.