Closed weiweihuanghuang closed 3 years ago
You mean the height of the bottom Preview?
That’s actually not new in G3, what do you mean then?
However, syncing the riszing of the bottom Preview height seems to be broken now, so I’ll see how I can fix that.
No I mean how you can drag the horizontal position of whats in the preview panel, like drag it left and right
I also noticed the preview panel height doesn't synch, it seems to be 0.5 off when I use similar code
I also noticed the preview panel height doesn't synch, it seems to be 0.5 off when I use similar code
Yea, that's what I referred to in my previous answer. That worked before but seems broken now. What do you mean by 0.5 off? Off of what?
Thanks for reporting. Didn't know about the horizontal content panning.
The measurement of the preview height sometimes includes then height of the drag separator and sometimes not. So you need to adjust for that in this case.
You should be able to
offset = previewView.valueForKey_("selectionOffset")
and
previewView.setValue_ForKey_(offset, "selectionOffset")
previewView.setNeedsDisplay_(True)
The measurement of the preview height sometimes includes then height of the drag separator and sometimes not. So you need to adjust for that in this case.
How do you find out if this needs to be adjusted for?
When I try to run:
Glyphs.fonts[1].currentTab.previewView.setValue_ForKey_(currentOffset, "selectionOffset")
I get this:
AttributeError: 'objc.native_selector' object has no attribute 'setValue_ForKey_'
or if I run:
Glyphs.fonts[1].currentTab.previewView().setValue_ForKey_(currentOffset, "selectionOffset")
I get:
AttributeError: 'NSKVONotifying_GSGlyphsPreview' object has no attribute 'setValue_ForKey_'
Am I doing this right?
sorry, I mistyped it:
Glyphs.fonts[1].currentTab.previewView().setValue_forKey_(currentOffset, "selectionOffset")
@schriftgestalt what's the code for getting the horizontal dragging offset in the preview panel (attached, not the window) and synching that?
Can you try this:
currentOffset = font.currentTab.previewView().offset()
font.currentTab.previewView().setOffset_(newOffset)
Thanks I just tried it but it doesn't work
setOffset_() doesn't seem to do anything
Sorry for the mess. I had another look and testes it this time:
from Foundation import NSPoint, NSValue
currentOffset = Font.currentTab.previewView().valueForKey_("userOffset")
print(currentOffset)
Font.currentTab.previewView().setValue_forKey_(NSValue.valueWithPoint_(NSPoint(-200, 0)), "userOffset")
Font.currentTab.previewView().setNeedsDisplay_(True)
Thanks Georg!
Now that in G3 you can freely drag around the horizontal position in the preview panel, this should ideally be synched I think when the plugin is running.