-
Notifications
You must be signed in to change notification settings - Fork 15
Why is anchor_point
reset for cell contents?
#49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The logic used to determine the assumes that the anchor point of the content object will be |
That being said some sort of gravity = center or possibly even right functionality would be a good feature to add. I'm definitely open to those if anyone wants to make a PR that adds the ability for it to use 0.5 anchor points and computes the center of it's cell instead of the top left like it does now. |
Hmm I guess I'm unclear on what |
The anchor_position location is in pixels within the objects parent's coordinate space. In the most basic usage it's parent is the display itself and thus it's placed in screen coordinates. But it can go inside of other parents like Groups or Widgets which end up having their own coordinate space. |
Yeah I've been over those guides many times. And I can get anchoring to work when I have full control over the layout. I think my main issue with the current anchoring system is it's pretending to be a relative parameter ( It feels at odds with other layout managers I've known (Qt, Swing, CSS, etc) where the component only knows its preferred/min/max size and it is the component container that is given hints on how to lay out that component (left/center/right, top/center/bottom, padding, margin, and so on). |
I was looking into a question someone in #help-with-circuitpython had about centering text, and noticed in this conditional, if the content has
anchor_point
, it's then reset to(0,0)
.Adafruit_CircuitPython_DisplayIO_Layout/adafruit_displayio_layout/layouts/grid_layout.py
Line 155 in e5e8b5a
The text was updated successfully, but these errors were encountered: