Skip to content

Commit

Permalink
feat: resize the Settings window at Ctrl-+
Browse files Browse the repository at this point in the history
  • Loading branch information
carrascomj committed Aug 2, 2023
1 parent cd1d810 commit 5e9523e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Controls
the button to zoom in/out to rotate it. On axis mode, scale the axis instead.
* **Middle click** on a histogram or the legend (on its center) and drag the mouse while holding
the button to move it.
* :code:`+` and :code:`-` keys to scale up and down the legend.
* :code:`+` and :code:`-` keys to scale up and down the legend. If :code:`Control` is pressed,
the Settings are scale
* :code:`s` to toggle axis mode, which shows the histogram axes and allows for scaling them.

Contents
Expand Down
17 changes: 13 additions & 4 deletions src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::info::Info;
use bevy::prelude::*;
use bevy_egui::egui::color_picker::{color_edit_button_rgba, Alpha};
use bevy_egui::egui::epaint::color::Rgba;
use bevy_egui::{egui, EguiContext, EguiPlugin};
use bevy_egui::{egui, EguiContext, EguiPlugin, EguiSettings};
use bevy_prototype_lyon::prelude::DrawMode;
use itertools::Itertools;
use std::collections::HashMap;
Expand Down Expand Up @@ -535,11 +535,20 @@ fn follow_mouse_on_scale(
}

/// Change size of UI on +/-.
fn scale_ui(key_input: Res<Input<KeyCode>>, mut ui_scale: ResMut<UiScale>) {
fn scale_ui(
key_input: Res<Input<KeyCode>>,
mut ui_scale: ResMut<UiScale>,
mut egui_settings: ResMut<EguiSettings>,
) {
let scale = if key_input.pressed(KeyCode::LControl) {
&mut egui_settings.scale_factor
} else {
&mut ui_scale.scale
};
if key_input.just_pressed(KeyCode::Plus) {
ui_scale.scale += 0.1;
*scale += 0.1;
} else if key_input.just_pressed(KeyCode::Minus) {
ui_scale.scale -= 0.1;
*scale = 0.1;
}
}

Expand Down

0 comments on commit 5e9523e

Please sign in to comment.