|
|
|
|
@ -11,10 +11,11 @@ impl Plugin for UiPlugin {
|
|
|
|
|
(
|
|
|
|
|
manage_cursor.run_if(any_component_changed::<Interaction>),
|
|
|
|
|
interactive_button.run_if(any_component_changed::<Interaction>),
|
|
|
|
|
scale_ui
|
|
|
|
|
.run_if(any_component_changed::<Window>)
|
|
|
|
|
.run_if(resource_exists::<tweak::GameTweaks>()),
|
|
|
|
|
scale_ui.run_if(on_event::<AssetEvent<tweak::Tweaks>>()),
|
|
|
|
|
scale_ui.run_if(
|
|
|
|
|
on_event::<AssetEvent<tweak::Tweaks>>()
|
|
|
|
|
.or_else(any_component_changed::<Window>)
|
|
|
|
|
.and_then(resource_exists::<tweak::GameTweaks>()),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -90,12 +91,15 @@ fn scale_ui(
|
|
|
|
|
*resolution_set = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Setting UI Scale based on ratio of expected to current ratio
|
|
|
|
|
let width_ratio = w.resolution.width() / width;
|
|
|
|
|
let height_ratio = w.resolution.height() / height;
|
|
|
|
|
let new_scale = (width_ratio).min(height_ratio) as f64;
|
|
|
|
|
if ui_scale.0 != new_scale {
|
|
|
|
|
ui_scale.0 = new_scale;
|
|
|
|
|
// Check if window is minimized
|
|
|
|
|
if w.resolution.height() > 0.0 && w.resolution.height() > 0.0 {
|
|
|
|
|
// Setting UI Scale based on ratio of expected to current ratio
|
|
|
|
|
let width_ratio = w.resolution.width() / width;
|
|
|
|
|
let height_ratio = w.resolution.height() / height;
|
|
|
|
|
let new_scale = (width_ratio).min(height_ratio) as f64;
|
|
|
|
|
if ui_scale.0 != new_scale {
|
|
|
|
|
ui_scale.0 = new_scale;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|