Cursor keys to move markers
This commit is contained in:
55
PBMap.pb
55
PBMap.pb
@@ -585,6 +585,11 @@ Module PBMap
|
|||||||
*Location\Latitude = Degree(ATan(SinH(#PI * (1.0 - 2.0 * *Coords\y / n))))
|
*Location\Latitude = Degree(ATan(SinH(#PI * (1.0 - 2.0 * *Coords\y / n))))
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
;Ensures the longitude to be in the range [-180;180[
|
||||||
|
Procedure.d ClipLongitude(Longitude.d)
|
||||||
|
ProcedureReturn Mod(Mod(Longitude + 180, 360.0) + 360.0, 360.0) - 180
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
;Lat Lon coordinates 2 pixel absolute [0 to 2^Zoom * TileSize [
|
;Lat Lon coordinates 2 pixel absolute [0 to 2^Zoom * TileSize [
|
||||||
Procedure LatLon2Pixel(*Location.GeographicCoordinates, *Pixel.PixelCoordinates, Zoom)
|
Procedure LatLon2Pixel(*Location.GeographicCoordinates, *Pixel.PixelCoordinates, Zoom)
|
||||||
Protected tilemax = Pow(2.0, Zoom) * PBMap\TileSize
|
Protected tilemax = Pow(2.0, Zoom) * PBMap\TileSize
|
||||||
@@ -1410,11 +1415,41 @@ Module PBMap
|
|||||||
Case #PB_Shortcut_Delete
|
Case #PB_Shortcut_Delete
|
||||||
DeleteSelectedMarkers()
|
DeleteSelectedMarkers()
|
||||||
EndSelect
|
EndSelect
|
||||||
|
PBMap\Redraw = #True
|
||||||
If GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Modifiers)&#PB_Canvas_Control = 0
|
If GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Modifiers)&#PB_Canvas_Control = 0
|
||||||
CtrlKey = #False
|
CtrlKey = #False
|
||||||
EndIf
|
EndIf
|
||||||
Case #PB_EventType_KeyDown
|
Case #PB_EventType_KeyDown
|
||||||
If GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Modifiers)&#PB_Canvas_Control <> 0
|
With PBMap\Markers()
|
||||||
|
Select GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Key)
|
||||||
|
Case #PB_Shortcut_Left
|
||||||
|
ForEach PBMap\Markers()
|
||||||
|
If \Selected
|
||||||
|
\GeographicCoordinates\Longitude = ClipLongitude( \GeographicCoordinates\Longitude - 10* 360 / Pow(2, PBMap\Zoom + 8))
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
Case #PB_Shortcut_Up
|
||||||
|
ForEach PBMap\Markers()
|
||||||
|
If \Selected
|
||||||
|
\GeographicCoordinates\Latitude + 10* 360 / Pow(2, PBMap\Zoom + 8)
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
Case #PB_Shortcut_Right
|
||||||
|
ForEach PBMap\Markers()
|
||||||
|
If \Selected
|
||||||
|
\GeographicCoordinates\Longitude = ClipLongitude( \GeographicCoordinates\Longitude + 10* 360 / Pow(2, PBMap\Zoom + 8))
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
Case #PB_Shortcut_Down
|
||||||
|
ForEach PBMap\Markers()
|
||||||
|
If \Selected
|
||||||
|
\GeographicCoordinates\Latitude - 10* 360 / Pow(2, PBMap\Zoom + 8)
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
EndSelect
|
||||||
|
EndWith
|
||||||
|
PBMap\Redraw = #True
|
||||||
|
If GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_Modifiers)&#PB_Canvas_Control <> 0
|
||||||
CtrlKey = #True
|
CtrlKey = #True
|
||||||
EndIf
|
EndIf
|
||||||
Case #PB_EventType_LeftDoubleClick
|
Case #PB_EventType_LeftDoubleClick
|
||||||
@@ -1513,9 +1548,9 @@ Module PBMap
|
|||||||
If Distance(MarkerCoords\x, MarkerCoords\y, MouseX, MouseY) < 8
|
If Distance(MarkerCoords\x, MarkerCoords\y, MouseX, MouseY) < 8
|
||||||
PBMap\Markers()\Focus = #True
|
PBMap\Markers()\Focus = #True
|
||||||
Else
|
Else
|
||||||
If CtrlKey = #False
|
;If CtrlKey = #False
|
||||||
PBMap\Markers()\Focus = #False
|
PBMap\Markers()\Focus = #False
|
||||||
EndIf
|
;EndIf
|
||||||
EndIf
|
EndIf
|
||||||
Next
|
Next
|
||||||
EndIf
|
EndIf
|
||||||
@@ -1743,10 +1778,10 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
; IDE Options = PureBasic 5.50 (Windows - x64)
|
; IDE Options = PureBasic 5.42 LTS (Windows - x64)
|
||||||
; CursorPosition = 1500
|
; CursorPosition = 1433
|
||||||
; FirstLine = 1478
|
; FirstLine = 1405
|
||||||
; Folding = -------------
|
; Folding = -------------
|
||||||
|
; EnableUnicode
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
||||||
; EnableUnicode
|
|
Reference in New Issue
Block a user