Match photo selection and rendered canvas to device rotation
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
"""Resolve a device's visual canvas without coupling rendering to its driver."""
|
||||
|
||||
|
||||
def frame_canvas(display, orientation=None):
|
||||
width, height = display.width, display.height
|
||||
if orientation == "landscape":
|
||||
return max(width, height), min(width, height)
|
||||
if orientation == "portrait":
|
||||
return min(width, height), max(width, height)
|
||||
return (height, width) if display.rotation % 180 == 90 else (width, height)
|
||||
Reference in New Issue
Block a user