souplesse

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 6e092a83ae81af6efa2d967d0893c30ca09fa421
parent 5b9697e283f3b3494963c1024c22b779527175f3
Author: Daniel Barlow <dan@telent.net>
Date:   Fri, 15 Nov 2024 22:08:12 +0000

eat mouse wheel events destimed for map zoom

stop propagation, prevent default

Diffstat:
Mfrontend/src/Main.elm | 21++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm @@ -404,12 +404,19 @@ canvas centre zoom width height track = portalWidth = 600 portalHeight = 600 -wheelDecoder : D.Decoder Msg -wheelDecoder = - D.map3 MapZoomWheel - (D.field "deltaX" D.float) - (D.field "deltaY" D.float) - (D.field "deltaMode" D.int) +withSwallowing m = + { message = m + , stopPropagation = True + , preventDefault = True + } + +mapWheelDecoder = + D.map withSwallowing + (D.map3 MapZoomWheel + (D.field "deltaX" D.float) + (D.field "deltaY" D.float) + (D.field "deltaMode" D.int)) + viewDiv : Model -> Html Msg viewDiv model = @@ -419,7 +426,7 @@ viewDiv model = , style "column-gap" "15px" ] [ div [ style "display" "flex" - , on "wheel" wheelDecoder + , Html.Events.custom "wheel" mapWheelDecoder , style "flex-direction" "column"] [ div [ style "width" (px portalWidth) , style "height" (px portalHeight)