Skip to content

Add Event::WindowScale and Ctx::scale for easier scale handling.#2335

Merged
xStrom merged 5 commits intolinebender:masterfrom
xStrom:pipe-scale
Jan 16, 2023
Merged

Add Event::WindowScale and Ctx::scale for easier scale handling.#2335
xStrom merged 5 commits intolinebender:masterfrom
xStrom:pipe-scale

Conversation

@xStrom
Copy link
Member

@xStrom xStrom commented Jan 16, 2023

Event::WindowScale wasn't fully connected, but the druid-shell part of it is somewhat functional, although not complete. Still, it's better to move this forward and surface the event to widgets.

The Ctx::scale method is added to every context and makes accessing the current window's scale as easy as accessing the widget's size. This is really a convenience method to improve ergonomics and doesn't enable new functionality.

Additionally I cleaned up the new SVG widget (from #2106) and it now makes use of this scale information to properly render the SVG at various scale factors.

Fixes #2333

@xStrom xStrom added widget concerns a particular widget architecture changes the architecture, usually breaking S-needs-review waits for review labels Jan 16, 2023
Copy link
Member

@jneem jneem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoever wrote svg originally didn't like imports 😄

@james-lawrence
Copy link
Contributor

@jneem no i didn't. =)

@james-lawrence
Copy link
Contributor

@xStrom all looks good to me. =)

@xStrom xStrom removed the S-needs-review waits for review label Jan 16, 2023
@xStrom xStrom merged commit 16e340b into linebender:master Jan 16, 2023
@xStrom xStrom deleted the pipe-scale branch January 16, 2023 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

architecture changes the architecture, usually breaking widget concerns a particular widget

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SVG widget doesn't respect scale

3 participants