Mouse wheel-zooming effect in svg - how to zoom to the center point of the work area , and how to stop the zoom level when it reaches the minimum and maximum zoom level. Where to set this min and max zoom values ?
Below is my code, I had reset the zoom level in the zoomChanged
function of svgedit.compiled.js
if (zoomlevel < 0.4) {
//changeZoom({value: 0.4});
var zoomlevel = 0.4;
return;
}
if (zoomlevel > 9.5) {
// changeZoom({value: 9.5});
var zoomlevel = 9.5;
return;
}
and in ext-grid.js
i had place the below code
zoomChanged: function(zoom) {
if (showGrid)
{
if(zoom > 0.4 & zoom < 9.5)
{
updateGrid(zoom);
}
}
},
When the mouse wheel is scrolled and when it reaches 0.4 or 9.5 the grid stop scaling but the zooming level still changes, and it zooms to the point where mouse is placed.
I need the work area should be zoomed to the center wherever the mouse is placed, and when it reaches minimum 0.4
or maximum 9.5
zooming should be stopped.
Can any one guide me, where have i had gone wrong?