Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zooming Behavior: Implement Zoom to target Mouse Cursor #769

Open
Avinaba-Mazumdar opened this issue Feb 7, 2025 · 0 comments
Open

Zooming Behavior: Implement Zoom to target Mouse Cursor #769

Avinaba-Mazumdar opened this issue Feb 7, 2025 · 0 comments

Comments

@Avinaba-Mazumdar
Copy link

Currently, the jquery.orgchart plugin zooms to the center of the chart container by default. This behavior is not ideal for exploring large or complex organizational charts, as users often want to zoom in on specific areas of the chart.

    zoomWheelHandler: function (e) {
        var t = e.data.oc;
        e.preventDefault();

        var mouseX = e.originalEvent.clientX - t.$chart.offset().left;
        var mouseY = e.originalEvent.clientY - t.$chart.offset().top;

        var scaleChange = 1 + (0 < e.originalEvent.deltaY ? -0.05 : 0.05);
        var newScale = t.$chart.data("scale") ? t.$chart.data("scale") * scaleChange : scaleChange;

        t.$chart.css("transform-origin", mouseY + "px " + mouseX + "px");
        t.setChartScale(t.$chart, newScale);
    },

i tried this, but its not working as expected

anyone here have a solution?

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant