Skip to content

Conversation

@TeamDman
Copy link

@TeamDman TeamDman commented Oct 23, 2025

Egui provides some built-in zoom factor manipulation.

Egui includes:

  • ctrl+'+'
  • ctrl+'-'
  • ctrl+'0'
  • zoom_menu_buttons(ui);

When using the ui.rs example before applying this change, when using the built-in egui scaling hotkeys, the UI flickers for one frame but there is no resulting scale change.

These proposed changes add support for changes to egui zoom_factor being propagated back to the bevy_egui scale_factor.

The changes include adding ctrl+[ and ctrl+] hotkeys to the ui.rs example to demonstrate that both egui and bevy_egui can harmoniously adjust the zoom factor with no one-frame problems.

To experience the changes, run the ui.rs example and use the ctrl+[, ctrl+], ctrl+'+', ctrl+'-' hotkeys to observe scale changes being initiated from both egui and bevy_egui.

It's a bit fiddly to make sure that the values are synced properly while allowing either to initiate a change with no flickering lol

My understanding is that the bevy_egui scale factor was introduced before egui had its own scale factor, so there's future opportunity to remove the bevy_egui scale factor entirely, but until then this should be a good middle ground.

related: #244

Copilot AI review requested due to automatic review settings October 23, 2025 16:07

This comment was marked as off-topic.

@vladbat00
Copy link
Owner

Hi, thanks for the PR! I'll do a full review a bit later.

My understanding is that the bevy_egui scale factor was introduced before egui had its own scale factor, so there's future opportunity to remove the bevy_egui scale factor entirely, but until then this should be a good middle ground.

You are right. I actually don't mind if we remove it with this PR, might as well make the code simpler.

@TeamDman
Copy link
Author

Will give it a shot to remove the bevy_egui scale factor altogether, will make that a separate PR and will abandon this one once ready

@TeamDman
Copy link
Author

I tried removing the scale factor entirely, but it wasn't as straightforward as I hoped, will keep this PR open

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

Successfully merging this pull request may close these issues.

2 participants