Closed jishnu7 closed 8 years ago
Did this fix work for you? I tried in simulator and on device without any change in behavior.
Yes. I tried it in simulator, it was working fine. On Jan 24, 2015 12:01 AM, "Joe Wilm" notifications@github.com wrote:
Did this fix work for you? I tried in simulator and on device without any change in behavior.
— Reply to this email directly or view it on GitHub https://github.com/gameclosure/timestep/pull/39#issuecomment-71240324.
Here's how this looks in my simulator:
It seems to me that centerAnchor shouldn't be part of the BoxLayout at all. Rather, it should be part of view initialization and view option updating.
if (opts.centerAnchor) {
opts.anchorX = opts.w / 2;
opts.anchorY = opts.h / 2;
}
Am I missing something? @mgh can you comment?
I assume it is in BoxLayout
so that the anchor updates whenever the width and height changes (on reflow
). It's unclear to me what the exact behavior should be -- should it be a convenience property for initialization that doesn't actually maintain a centered anchor? Should setting it automatically enable a box layout? I'd almost rather have it be a helper function than an opts property, though this runs counter to the trend toward 100% declarative opts.
Sorry. My bad. This change is not working, I might have messed up with multiple copies of devkit-core.
I tested this again today. Found that this patch is actually working. I'll post a screenshot
Can you explain how to make this work? I have a fresh app with up to date devkit core and you're timestep patch. My result is the gif above.
I would expect centerAnchor
to apply once on view init for views without layout / reflow, and to apply on each reflow for views within a layout. Changing the individual anchors manually should be fine, but would get overwritten if a reflow occurs and the view is in a layout. If you all agree and this patch works accordingly, than we can merge. I'll give it a test!
@mgh @jishnu7 I placed a new pull request based on this one that enforces centerAnchor
whenever width
or height
are changed, regardless of the view's layout or lack thereof: https://github.com/gameclosure/timestep/pull/81
Closing this pull request, comment on the new one if it works for you and I'll merge!
centerAnchor supposed to recenter the view on dimension change. It got removed in the timestep for devkit2.