dabeng / vue-orgchart

It's a simple and direct organization chart plugin. Anytime you want a tree-like chart, you can turn to OrgChart.
MIT License
290 stars 89 forks source link

BUG: Zoom on center instead on current mouse position #16

Open EdinCeman opened 5 years ago

EdinCeman commented 5 years ago

Hi,

while using your plugin for org chart (which is BTW amazing thanks a lot), I noticed that when you apply the zoom function on the chart you only watch and change the matrix scale property and the translationX and Y stays 0. This leads to constantly zooming to center of the div and not on the current mouse position. Also when zooming is enabled you should set overflow from auto to hidden to prevent collision between scroll and zoom on mouse wheel. Solution is that you track where is the current mouse position on x and y and than subtract the offset of the div x an y, so your mouse position does not move while zooming in. This value is then inserted in last 2 parameters of matrix and the problem should be solved.

Thanks again for amazing plugin and keep up the good work :) .