Zoom in / Zoom Out

Hi All
I am Using canvas.zoom() in order To Handle zooming Manually

	var zoomlevel = 0;

	$("#btnzoomin").on("click", function () {
		if (zoomlevel != 5) {
			var canvas = modeler.get('canvas');				
			canvas.zoom(++zoomlevel);
		}

	})

	$("#btnzoomout").on("click", function () {
		if (zoomlevel != -6) {
			var canvas = modeler.get('canvas');	
			canvas.zoom(--zoomlevel);
		}
	})

but when the “zoomlevel” is negative and is passed to zoom() function the diagram starts to get magnified instaed of getting shrink !!!
What I Am doing Worng?

Hey,

the parameter for canvas.zoom is like a multiplier. You should provide 1 for 100%, 0.5 for an absolute zoom level of 50% and so on. That’s why negative values show unexpected behaviour.

1 Like

thank you @pedesen
that worked

Hi @nikku , I have checked in bpmn modeler zoom-in zoom-out functionality, but after max or min zoom as per parent canvas, the plus and minus button not get disabled, how can we do this, or its possible to add this improvement in upcoming release.1

The plus and minus controls would need to be updated once the max / min zoom level is reached. The UI is not part of the core, hence don’t expect a fix on our end.

Generally speaking, please do not necrobump old topics. Instead link to this thread from new topic.