Skip to content
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

handle rotation in a more elegant way? #13

Closed
ladyada opened this issue Nov 19, 2020 · 4 comments
Closed

handle rotation in a more elegant way? #13

ladyada opened this issue Nov 19, 2020 · 4 comments

Comments

@ladyada
Copy link
Member

ladyada commented Nov 19, 2020

for now this works, if you set the rotation thru the magtag.display you need to recreate the magtag object... or maybe this is fine!

import time
import board
import terminalio
from adafruit_magtag.magtag import MagTag

board.DISPLAY.rotation = 270
magtag = MagTag()

magtag.add_text(
    text_font=terminalio.FONT,
    text_position=(
        magtag.graphics.display.width // 2,
        magtag.graphics.display.height // 2,
    ),
    text_anchor_point=(0.5, 0.5),
    text_scale=3,
)

if magtag.display.rotation in (90, 270):
    magtag.set_text("Hello World")
else:
    magtag.set_text("Hello\nWorld")
while True:
    pass
@makermelissa
Copy link
Contributor

Now that board.DISPLAY is included in Magtag, I plan on removing the display driver init code which isn't being used at this point. Changing board.DISPLAY.rotation should be the same as changing magtag.display.rotation, but perhaps it's not. I'll try some things next week when I start working on factoring out a portal base library. Maybe we need some kind of update function that handles it.

@ladyada
Copy link
Member Author

ladyada commented Nov 19, 2020

it is the same but the display buffer uses the old dimensions, we need to update those

@makermelissa
Copy link
Contributor

Ok, then maybe we can make a property that handles this, though that may or may not be a more elegant way.

@ladyada ladyada closed this as completed Dec 6, 2020
@ladyada
Copy link
Member Author

ladyada commented Dec 6, 2020

with deep sleep this may not be an issue anymore, we'll start over fresh on every run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants