sketch-hq/SketchAPI

.setZoomValue() doesn't properly zoom or update the UI

alexkaessner opened this issue · 3 comments

Hi there!

I've made a tiny plug-in for Sketch that allows users to zoom to custom zoom values. I've noticed that the context.document.setZoomValue(55/100) isn't working correctly. When using this code Sketch updates the toolbar item to the correct value (55% in this case), but the actual canvas stays at the same zoom level not before I start scrolling. Only if I start scrolling in any direction the canvas zooms to the set value.

I've noticed this issue with Sketch 66.1 (97080) on macOS 10.15.4 (19E287).

Live demonstration:
sketch bug

Try context.document.canvasView().zoomValue = someNumber (you can also use context.document.contentDrawView().zoomValue for support before 65. For issues related to internal sketch methods you’ll have more luck posting on the Sketch Plugins forum.

@KevinGutowski Awesome thanks for the help Kevin! That works just fine.

I'm not sure if this issue should be closed then. As this isn't really documented I'm not sure if this issue related to the Sketch API.

As @KevinGutowski said, since the method is not documented in the public API there's not much to do here.

Closing!