replace MapZoomWheel with MapScale

which doesn't require but subsequently ignore x and mode fields
This commit is contained in:
Daniel Barlow 2024-11-15 22:14:54 +00:00
parent 6e092a83ae
commit 536f45a26c

View File

@ -179,7 +179,7 @@ fetchTrack start duration = Http.get
type Msg
= MapZoomIn
| MapZoomOut
| MapZoomWheel Float Float Int
| MapScale Float
| Scroll Int Int
| PointerDown (Int, Int)
| PointerMove (Int, Int)
@ -201,10 +201,8 @@ newModel msg model =
MapZoomOut ->
{ model | zoom = incZoom model.zoom -zoomStep }
MapZoomWheel x y delta ->
let dir = if y > 0
then -1
else 1
MapScale y ->
let dir = floor(abs(y)/y)
in { model | zoom = incZoom model.zoom dir }
Scroll x y ->
{ model | centre = translatePixels model.centre (toZoom model.zoom) (x,y) }
@ -410,12 +408,9 @@ withSwallowing m =
, preventDefault = True
}
-- FIXME should do something useful with deltaMode as well as deltaY
mapWheelDecoder =
D.map withSwallowing
(D.map3 MapZoomWheel
(D.field "deltaX" D.float)
(D.field "deltaY" D.float)
(D.field "deltaMode" D.int))
D.map (withSwallowing << MapScale) (D.field "deltaY" D.float)
viewDiv : Model -> Html Msg