eat mouse wheel events destimed for map zoom
stop propagation, prevent default
This commit is contained in:
parent
5b9697e283
commit
6e092a83ae
@ -404,12 +404,19 @@ canvas centre zoom width height track =
|
|||||||
portalWidth = 600
|
portalWidth = 600
|
||||||
portalHeight = 600
|
portalHeight = 600
|
||||||
|
|
||||||
wheelDecoder : D.Decoder Msg
|
withSwallowing m =
|
||||||
wheelDecoder =
|
{ message = m
|
||||||
D.map3 MapZoomWheel
|
, stopPropagation = True
|
||||||
|
, preventDefault = True
|
||||||
|
}
|
||||||
|
|
||||||
|
mapWheelDecoder =
|
||||||
|
D.map withSwallowing
|
||||||
|
(D.map3 MapZoomWheel
|
||||||
(D.field "deltaX" D.float)
|
(D.field "deltaX" D.float)
|
||||||
(D.field "deltaY" D.float)
|
(D.field "deltaY" D.float)
|
||||||
(D.field "deltaMode" D.int)
|
(D.field "deltaMode" D.int))
|
||||||
|
|
||||||
|
|
||||||
viewDiv : Model -> Html Msg
|
viewDiv : Model -> Html Msg
|
||||||
viewDiv model =
|
viewDiv model =
|
||||||
@ -419,7 +426,7 @@ viewDiv model =
|
|||||||
, style "column-gap" "15px"
|
, style "column-gap" "15px"
|
||||||
]
|
]
|
||||||
[ div [ style "display" "flex"
|
[ div [ style "display" "flex"
|
||||||
, on "wheel" wheelDecoder
|
, Html.Events.custom "wheel" mapWheelDecoder
|
||||||
, style "flex-direction" "column"]
|
, style "flex-direction" "column"]
|
||||||
[ div [ style "width" (px portalWidth)
|
[ div [ style "width" (px portalWidth)
|
||||||
, style "height" (px portalHeight)
|
, style "height" (px portalHeight)
|
||||||
|
Loading…
Reference in New Issue
Block a user