replace MapZoomWheel with MapScale
which doesn't require but subsequently ignore x and mode fields
This commit is contained in:
parent
6e092a83ae
commit
536f45a26c
@ -179,7 +179,7 @@ fetchTrack start duration = Http.get
|
|||||||
type Msg
|
type Msg
|
||||||
= MapZoomIn
|
= MapZoomIn
|
||||||
| MapZoomOut
|
| MapZoomOut
|
||||||
| MapZoomWheel Float Float Int
|
| MapScale Float
|
||||||
| Scroll Int Int
|
| Scroll Int Int
|
||||||
| PointerDown (Int, Int)
|
| PointerDown (Int, Int)
|
||||||
| PointerMove (Int, Int)
|
| PointerMove (Int, Int)
|
||||||
@ -201,10 +201,8 @@ newModel msg model =
|
|||||||
MapZoomOut ->
|
MapZoomOut ->
|
||||||
{ model | zoom = incZoom model.zoom -zoomStep }
|
{ model | zoom = incZoom model.zoom -zoomStep }
|
||||||
|
|
||||||
MapZoomWheel x y delta ->
|
MapScale y ->
|
||||||
let dir = if y > 0
|
let dir = floor(abs(y)/y)
|
||||||
then -1
|
|
||||||
else 1
|
|
||||||
in { model | zoom = incZoom model.zoom dir }
|
in { model | zoom = incZoom model.zoom dir }
|
||||||
Scroll x y ->
|
Scroll x y ->
|
||||||
{ model | centre = translatePixels model.centre (toZoom model.zoom) (x,y) }
|
{ model | centre = translatePixels model.centre (toZoom model.zoom) (x,y) }
|
||||||
@ -410,12 +408,9 @@ withSwallowing m =
|
|||||||
, preventDefault = True
|
, preventDefault = True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- FIXME should do something useful with deltaMode as well as deltaY
|
||||||
mapWheelDecoder =
|
mapWheelDecoder =
|
||||||
D.map withSwallowing
|
D.map (withSwallowing << MapScale) (D.field "deltaY" D.float)
|
||||||
(D.map3 MapZoomWheel
|
|
||||||
(D.field "deltaX" D.float)
|
|
||||||
(D.field "deltaY" D.float)
|
|
||||||
(D.field "deltaMode" D.int))
|
|
||||||
|
|
||||||
|
|
||||||
viewDiv : Model -> Html Msg
|
viewDiv : Model -> Html Msg
|
||||||
|
Loading…
Reference in New Issue
Block a user