Lock zoom to absolute scale


#1

Hi,
I’m new to scripting and I’m trying to create a very simple one that locks the “zoom”. The script works only when I execute it in the macro panel but stops, even if I added a callback.

def setscale(v):
	if Glyphs.font.currentTab.scale != v:
		Glyphs.currentDocument.windowController().activeEditViewController().graphicView().zoomViewToAbsoluteScale_(v)

Glyphs.addCallback(setscale(0.05), MOUSEMOVED)

#2

This seems to be quite dangerous. To set the zoom when you move the mouse. Why do you need that?

Do you get an error message?


#3

What I wanted is to disable temporarily the ability to zoom, locking it to a defined number. I’m experimenting with a new workflow that limits some aspects of the software, to be forced to judge the shapes in a smaller size. It doesn’t have to be updated when I move the mouse. Do you think of another possible solution, or do you think like this it is possible?
Thanks!


#4

To look at the shapes at a smaller scale you could use the preview view. I could give you a snipped to set it to a defined size.


#5

Yes, please. Although I wanted to limit the zoom in the editing, that could work as well.


#6

Does this help:

previewHeight = 100
splitView = Glyphs.font.currentTab.previewSplitView()
frame = splitView.frame()
splitView.setPosition_ofDividerAtIndex_(frame.size.height - previewHeight, 0)