commit 536f45a26ca80adfde11d88e517e6a373fa54d53
parent 6e092a83ae81af6efa2d967d0893c30ca09fa421
Author: Daniel Barlow <dan@telent.net>
Date: Fri, 15 Nov 2024 22:14:54 +0000
replace MapZoomWheel with MapScale
which doesn't require but subsequently ignore x and mode fields
Diffstat:
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm
@@ -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