Suggestion: Additional zooming options

Currently, the Zoom In/Out from the View menu (cmd +/-) zooms into the center of the window. I typically need to zoom into the area where I am focusing on. Just thinking about a couple of options that would be helpful:

Zoom to Selection
As a complement to the existing Zoom to Active Layer option then can be a Zoom to Selection option. This can either be a selected node or a selection of multiple nodes whose local center would set the area to zoom to.

Zoom to Cursor Position
Seems like there are two ways to zoom to the cursor position: 1) pinching with a trackpad 2) Hold Option with scroll wheel. I usually use a trackpad but after a while, my hand starts to hurt. It would be helpful to be able to replicate this with a key command/shortcut.

Would it be useful enough to add these as zoom options to the View menu?

Have you seen this:?

I wasn’t aware of the shortcut for drag zooming. Could be handy.

However, I was looking for something with the ease of a cmd +/- so if I have a node selected then cmd + (or something similar…essentially anything that can be assigned a shortcut) and it will zoom directly into that node.

Ideally, I am trying to assign this sort of zoom function to a knob.

A knob? Like a slider-knob in the UI somewhere? Or is the node/handle a knob?

A knob on a physical controller :control_knobs:

If I can access a shortcut or have the function accessible through the menu, then I can assign it to a physical knob. Turn to the right to zoom in, turn left to zoom out.

You can write a script to zoom or pan exactly as needed and then trigger those scripts with a hardware controller.

Ok, I’ll give it a go. Any scripts you would recommend to work off of?

The portion of Edit View that is currently visible is known as the view port. You can read and set it like so:

# get current view port
editView = Font.currentTab
viewPort = editView.viewPort
# set position and size
viewPort.origin.x = newX
viewPort.origin.y = newY
viewPort.size.width = newWidth
viewPort.size.height = newHeight
# reposition view port of Edit View
editView.viewPort = viewPort

Thanks. I will try this.

I was having a look at Wei’s Zoom Wide script and it sets the zoom level using this:
Glyphs.font.currentTab.scale = 0.05

In the API, I came across the NSAffineTransform section about scale.

if a single number, scale uniformly, otherwise scale by x, y if center is given, that is used as the origin of the scale

Does this mean there is a way to set the origin of the scale? Or, is referring to some other scaling type that is separate from this. I’m not understanding how to set that value.

The NSAffineTransform has nothing to do with that. It can be used to transform paths and components. Or to modify bezier paths when drawing.