Add Zoom With Mouse Wheel

This commit is contained in:
2016-08-04 09:25:13 +02:00
parent d91ea5ed17
commit cd673bd3ff

View File

@@ -29,6 +29,7 @@ DeclareModule PBMap
;-Proxy ON/OFF ;-Proxy ON/OFF
Global Proxy = #False Global Proxy = #False
Declare InitPBMap() Declare InitPBMap()
Declare SetMapServer(ServerURL.s="http://tile.openstreetmap.org/",TileSize.l=256,ZoomMin.l=0,ZoomMax.l=18)
Declare MapGadget(Gadget.i, X.i, Y.i, Width.i, Height.i) Declare MapGadget(Gadget.i, X.i, Y.i, Width.i, Height.i)
Declare Event(Event.l) Declare Event(Event.l)
Declare SetLocation(latitude.d, longitude.d, zoom = 15, mode.i = #PB_Absolute) Declare SetLocation(latitude.d, longitude.d, zoom = 15, mode.i = #PB_Absolute)
@@ -841,7 +842,7 @@ Module PBMap
EndProcedure EndProcedure
Procedure RefreshMapGadget() Procedure RefreshMapGadget()
SignalSemaphore(OSM\Drawing\Semaphore) SignalSemaphore(PBMap\Drawing\Semaphore)
EndProcedure EndProcedure
Procedure Event(Event.l) Procedure Event(Event.l)
@@ -856,6 +857,8 @@ Module PBMap
Select Gadget Select Gadget
Case PBMap\Gadget Case PBMap\Gadget
Select EventType() Select EventType()
Case #PB_EventType_MouseWheel
SetZoom(GetGadgetAttribute(PBMap\Gadget,#PB_Canvas_WheelDelta),#PB_Relative)
Case #PB_EventType_LeftButtonDown Case #PB_EventType_LeftButtonDown
;Check if we select a marker ;Check if we select a marker
MouseX = PBMap\Position\x - GadgetWidth(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX) MouseX = PBMap\Position\x - GadgetWidth(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
@@ -1065,8 +1068,8 @@ CompilerIf #PB_Compiler_IsMainFile
CompilerEndIf CompilerEndIf
; IDE Options = PureBasic 5.50 (Windows - x86) ; IDE Options = PureBasic 5.50 (Windows - x86)
; CursorPosition = 272 ; CursorPosition = 860
; FirstLine = 224 ; FirstLine = 847
; Folding = --------- ; Folding = ---------
; EnableThread ; EnableThread
; EnableXP ; EnableXP