Hi ,
Like the title i want to change the diagram 's scale like zooming . I want to zoom to a specific amount like 25%, 150%, 200%, etc. I tried changing diagram.scale but it didn’t work. any suggest ?
Thanks,
Vu
Hi ,
Like the title i want to change the diagram 's scale like zooming . I want to zoom to a specific amount like 25%, 150%, 200%, etc. I tried changing diagram.scale but it didn’t work. any suggest ?
Thanks,
Vu
You can override CommandHandler.increaseZoom and decreaseZoom to set Diagram.scale to only particular values, such as 0.25, 1.50, 2.00, etc.
For reference, this is how it is defined:
CommandHandler.prototype.increaseZoom = function(factor) {
if (factor === undefined/*notpresent*/) factor = this.zoomFactor;
Util.checkRealNumber(factor, CommandHandler, 'increaseZoom:factor');
var diagram = this.diagram;
if (diagram === null) return;
if (diagram.autoScale !== Diagram.None) return;
var newscale = diagram.scale * factor;
if (newscale < diagram.minScale || newscale > diagram.maxScale) return;
diagram.scale = newscale;
};