Zooming to Actual Layer

Hello,

trying to improve my workflow in Glyphs with a two-step predefined zooming – while maintaining the possibility to zoom in and zoom out small steps with “cmd plus” and “cmd minus’”.

Now, tweaking Wei Huang’s Zoom Wide code I have two zoom states (two separate scripts in fact…) run by Keyboard Shortcuts. But it just zooms into the center of the screen.

How is it possible to trigger Zoom to Active Layer when using simple code like Glyphs.font.currentTab.scale = value?

or how to set a value of Zoom to Active Layer or Zoom to Actual Size?
Having an alt option for the Zoom to Active Layer, like a toggle, could also be a solution.

Maciej

Have a look at the Zoom to Selection plug-in. That should be doing what you are looking for.

Not really.
It’s based on selection, not active layer.
Thanks anyway!

But you should find all the API you need in those scripts.

Fit Zoom has a simple implementation of a similar behavior, but it’s not incremental

My idea would be:

Glyphs.font.currentTab.viewPort.selectedLayerOrigin.scale = value