rename messages for map dragging

This commit is contained in:
Daniel Barlow 2024-11-16 00:03:55 +00:00
parent 7fe09053e3
commit 5f02b5b992

View File

@ -178,9 +178,9 @@ fetchTrack start duration = Http.get
type Msg
= MapScale Int
| PointerDown (Int, Int)
| PointerMove (Int, Int)
| PointerUp (Int, Int)
| MapDragStart (Int, Int)
| MapDrag (Int, Int)
| MapDragFinish (Int, Int)
| TimeScale (Float)
| Loaded (Result Http.Error (List Point))
| NewUrlRequest
@ -196,13 +196,13 @@ newModel msg model =
MapScale y ->
{ model | zoom = incZoom model.zoom y }
PointerDown (x,y) ->
MapDragStart (x,y) ->
{ model | drag = Dragging (x,y) (x,y) }
PointerMove (x,y) ->
MapDrag (x,y) ->
{ model | drag = dragTo model.drag (x,y) }
PointerUp (x,y) ->
MapDragFinish (x,y) ->
{ model | drag = None,
centre = translatePixels model.centre (toZoom model.zoom) (dragDelta model.drag) }
@ -214,7 +214,6 @@ newModel msg model =
, duration = len
}
Loaded result ->
case result of
Ok trk -> { model | track = Present trk }
@ -395,9 +394,9 @@ canvas centre zoom width height model =
,style "left" (px -offsetX)
,style "top" (px -offsetY)
,style "lineHeight" (px 0)
,Pointer.onUp (\e -> PointerUp (epos e))
,Pointer.onMove (\e -> PointerMove (epos e))
,Pointer.onDown (\e -> PointerDown (epos e)) ]
,Pointer.onUp (\e -> MapDragFinish (epos e))
,Pointer.onMove (\e -> MapDrag (epos e))
,Pointer.onDown (\e -> MapDragStart (epos e)) ]
(tv :: tiles xs ys zoom)
portalWidth = 600