remove unnecessary layer of tab divs from edit.xml

This commit is contained in:
galister
2025-11-24 19:32:48 +09:00
parent 8485639e00
commit 8bd1097886
2 changed files with 37 additions and 44 deletions

View File

@@ -46,13 +46,10 @@
<div width="8" height="100%" /> <div width="8" height="100%" />
<TopButtonFaded src="watch/edit.svg" tooltip="EDIT_MODE.LEAVE" press="::EditToggle" /> <TopButtonFaded src="watch/edit.svg" tooltip="EDIT_MODE.LEAVE" press="::EditToggle" />
</div> </div>
<div id="tab_none" display="none"> <div id="tab_none" display="none" height="100">
<div height="100">
<label align="center" translation="EDIT_MODE.HINT_POINT_WINDOW" /> <label align="center" translation="EDIT_MODE.HINT_POINT_WINDOW" />
</div> </div>
</div> <div id="tab_pos" display="none" height="100" flex_direction="column">
<div id="tab_pos" display="none">
<div height="100" flex_direction="column">
<div padding="8" gap="8" justify_content="center" align_items="center"> <div padding="8" gap="8" justify_content="center" align_items="center">
<PosButton id="pos_static" src="edit/pin.svg" tooltip="EDIT_MODE.POS_STATIC" press="::EditModeSetPos static" /> <PosButton id="pos_static" src="edit/pin.svg" tooltip="EDIT_MODE.POS_STATIC" press="::EditModeSetPos static" />
<PosButton id="pos_anchored" src="edit/anchor.svg" tooltip="EDIT_MODE.POS_ANCHORED" press="::EditModeSetPos anchored" /> <PosButton id="pos_anchored" src="edit/anchor.svg" tooltip="EDIT_MODE.POS_ANCHORED" press="::EditModeSetPos anchored" />
@@ -66,16 +63,12 @@
<Slider id="lerp_slider" width="250" height="16" min_value="0.05" max_value="1" value="1" step="0.05" /> <Slider id="lerp_slider" width="250" height="16" min_value="0.05" max_value="1" value="1" step="0.05" />
</div> </div>
</div> </div>
</div> <div id="tab_alpha" display="none" height="100" padding="8" gap="8" justify_content="center" align_items="center">
<div id="tab_alpha" display="none">
<div height="100" padding="8" gap="8" justify_content="center" align_items="center">
<label translation="EDIT_MODE.OPACITY" /> <label translation="EDIT_MODE.OPACITY" />
<Slider id="alpha_slider" width="200" height="16" min_value="0.1" max_value="1" value="1" step="0.05" /> <Slider id="alpha_slider" width="200" height="16" min_value="0.1" max_value="1" value="1" step="0.05" />
<CheckBox id="additive_box" translation="EDIT_MODE.BLENDING_ADDITIVE" tooltip="EDIT_MODE.ALPHA_BLEND_MODE" tooltip_side="bottom" /> <CheckBox id="additive_box" translation="EDIT_MODE.BLENDING_ADDITIVE" tooltip="EDIT_MODE.ALPHA_BLEND_MODE" tooltip_side="bottom" />
</div> </div>
</div> <div id="tab_curve" display="none" height="100" flex_direction="column">
<div id="tab_curve" display="none">
<div height="100" flex_direction="column">
<div padding="8" gap="8" justify_content="center" align_items="center"> <div padding="8" gap="8" justify_content="center" align_items="center">
<label translation="EDIT_MODE.CURVATURE_EXPLANATION" /> <label translation="EDIT_MODE.CURVATURE_EXPLANATION" />
</div> </div>
@@ -85,7 +78,6 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</rectangle> </rectangle>
</div> </div>
</rectangle> </rectangle>

View File

@@ -1,11 +1,8 @@
use std::{collections::HashMap, rc::Rc}; use std::{collections::HashMap, rc::Rc};
use wgui::{ use wgui::{
components::button::ComponentButton, components::button::ComponentButton, event::CallbackDataCommon, layout::WidgetID,
event::CallbackDataCommon, parser::Fetchable, taffy,
layout::WidgetID,
parser::Fetchable,
taffy::{Display, Style},
}; };
use crate::overlays::edit::EditModeWrapPanel; use crate::overlays::edit::EditModeWrapPanel;
@@ -80,14 +77,18 @@ impl ButtonPaneTabSwitcher {
} }
fn set_tab_active(common: &mut CallbackDataCommon, data: &TabData, active: bool) { fn set_tab_active(common: &mut CallbackDataCommon, data: &TabData, active: bool) {
let style = Style { let mut style = common
display: if active { .state
Display::Block .get_widget_style(data.pane)
.unwrap_or(&taffy::Style::DEFAULT)
.clone();
style.display = if active {
taffy::Display::Block
} else { } else {
Display::None taffy::Display::None
},
..Default::default()
}; };
common.alterables.set_style(data.pane, style); common.alterables.set_style(data.pane, style);
if let Some(button) = data.button.as_ref() { if let Some(button) = data.button.as_ref() {
button.set_sticky_state(common, active); button.set_sticky_state(common, active);