Scripting: setting viewport origin affects viewport size

I am trying to implement a “Zoom to Selection” script. For this, I want to set the viewPort of the current tab. However, in Glyphs 3 setting the viewport origin also affects the viewport size which breaks my script. The following code-snippet demonstrates this:

editView = Font.currentTab
target = editView.viewPort.copy()
target.origin.x = editView.viewPort.origin.x + 50
editView.viewPort = target

Glyphs 2:

Glyphs 3:

This also affect other scripts like “Edit Next Glyph” of the Freemix collection.

Please use this code for now:

editView = Font.currentTab
target = editView.frameView().frameOrigin()
target.x += 50

I see if I can fix the viewport API
Edit: fixed it.

1 Like

Thank you!

Can confirm; 3060 fixes the issue.