sholloway / agents-playground

MIT License
4 stars 0 forks source link

Zooming UI #46

Open sholloway opened 1 year ago

sholloway commented 1 year ago

Enable Zooming in the UI.

UI Actions

Implementation Considerations

Zooming In

Cell-based layout may be able to help simplify this. For example at Zoom level 1, a cell width defaults to 20 pixels. This can be overridden in a scene file. I could simply have a zoom magnifier that impacts the cell size in the context.scene so all calculations that are cell-based will scale up or down.

horizontal_grid_offset = h_offset * (cell_width * zoom_level)
vertical_grid_offset = v_offset * (cell_height * zoom_level)

For things like line width, the zoom level will need to be specified. Something like

SizeInPixels = int
class DefaultStrokeSizes(Enum):
   ZOOM_1: SizeInPixels = 2
   ZOOM_2: SizeInPixels = 4
   ZOOM_3: SizeInPixels = 8
   ZOOM_4: SizeInPixels = 16
   and so on...

Fonts

The default font that ships with DearPyGUI doesn't scale (or look good for that matter). I'll need to bundle the app with a font and find a font that supports multiple sizes.

Zooming Out

Making things appear closer seems straightforward. Zooming out seems less intuitive.

Animation Considerations

For dynamic things like agents, what will be the impact of zooming? Following a path?