mekkablue / ShowInterpolations

Glyphs.app plugin for live-previewing all interpolated instances of the current glyph.
Apache License 2.0
23 stars 5 forks source link

Centering broken #14

Closed kontur closed 4 years ago

kontur commented 5 years ago

When I have centering turned on the alignment of the backgrounds seems to drift off screen with every screen update.

I was wondering if an update introduced this, so I rolled the plugin back to 4134ef8b054754e85ae9829d8f2501cc4744f27a which was a bugfix I submitted and know worked.

See in the video what is happening: Without centering behavior as expected. Then turning on centering with every background update the centering function seems to further offset the backgrounds. Switching the master seems to affect the direction the backgrounds are drifting, so my assumption is that in the code determining the center the width of the current layer comes into the calculation somehow.

https://drive.google.com/open?id=1_kBZNIZFtR4NWlsuM88NHqTSVHR5AQIk

Can you reproduce this?

Since I rolled back to a commit I know worked I am wondering if you are aware of anything in Glyphs that has has recently changed that could affect this?

kontur commented 5 years ago

I had a quick look at this today trying to figure out what’s going on but couldn’t get to the bottom of why the centering fails. Since centering on a node works, I tried replicating that code but with the layer center, but still the trace seems like the difference is calculated and applied, but the next update the difference is there again. For centering a node a difference is calculated, then the transform happens, and in subsequent frames the difference is 0. For the layer x calculation (following the otherwise same steps as the align centering) the difference never seems to be 0, but remains constant from update frame to frame.

My code in the elif following the node align code:

centerXInstance = interpolatedLayer.bounds.origin.x + interpolatedLayer.bounds.size.width/2
shift = self.transform( shiftX = (centerX - centerXInstance))
interpolatedLayer.transform_checkForSelection_doComponents_(shift,False,False)

I really don’t see how the one differs from the other, so the question is is there is something about the bounds reporting or about applying the transform that goes wrong here? I equally tried to make the shift simply move the layer to 0 for sake of testing, and that didn’t work either.

mekkablue commented 5 years ago

something about the bounds reporting

I believe that is the case. For now, centering should be disabled in app versions 1181+.

mekkablue commented 4 years ago

I believe this is not an issue in recent Glyphs.app builds anymore.

kontur commented 4 years ago

Can confirm the drifting doesn't happen any more on Version 2.6.3 (1270). I struggle to remember what the flag did — there seems to be no difference between on an off for me?