How do setActivePosition_ and zoomViewToRect_ work?

Continuing the discussion from Setting the same visibleRect (?) across each tab:

I’m still trying to make this script but the following code doesn’t do anything? Am I calling the wrong function
Font.currentTab.graphicView().zoomViewToRect_( NSRect( NSPoint(50, -615), (1264, 645) ) )
Font.currentTab.graphicView().setActivePosition_(NSPoint(1000, 55))

You can not set the activePosition. It is set automatically. All you might do with this is mess up the rendering.

Here is a working version:

1 Like

Following up on the activePosition and what I think it might be: I once asked if it will be possible to center the view around the caret. Like when the caret is positioned somewhere in a long string. Then I read in a changeLog, that it was implemented and should happen by default. But I never saw this happening. What was this about then?

I thought that part in the change log was referring to this in the preview panel— I had to disable it to return it to the default behaviour.
http://quick.as/3v39TooDv

activePosition has nothing to do with the scrolling, bit gives you the origin of the current glyphs in view coordinates. Construct an rect from it and then call GraphicView.scrollRectToVisible_(thisVisibleRect). By making the rect bigger you can define the centering.