Skip to content

Scroll zoom and scroll pan #356

Answered by rjtwins
rjtwins asked this question in Q&A
Discussion options

You must be logged in to vote

After looking at the source code i've done this:
Where the pan will be updated where the guard clauses are now.

        private void BlazorDiagram_Wheel(Blazor.Diagrams.Core.Events.WheelEventArgs e)
        {
            if (e.ShiftKey)
                return;

            if (e.AltKey)
                return;

            if (BlazorDiagram.Container == null || e.DeltaY == 0)
                return;

            var scale = BlazorDiagram.Options.Zoom.ScaleFactor;
            var oldZoom = BlazorDiagram.Zoom;
            var deltaY = BlazorDiagram.Options.Zoom.Inverse ? e.DeltaY * -1 : e.DeltaY;
            var newZoom = deltaY > 0 ? oldZoom * scale : oldZoom / scale;
            newZoom = M…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rjtwins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant