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,43 +46,35 @@
<div width="8" height="100%" />
<TopButtonFaded src="watch/edit.svg" tooltip="EDIT_MODE.LEAVE" press="::EditToggle" />
</div>
<div id="tab_none" display="none">
<div height="100">
<div id="tab_none" display="none" height="100">
<label align="center" translation="EDIT_MODE.HINT_POINT_WINDOW" />
</div>
<div id="tab_pos" display="none" height="100" flex_direction="column">
<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_anchored" src="edit/anchor.svg" tooltip="EDIT_MODE.POS_ANCHORED" press="::EditModeSetPos anchored" />
<PosButton id="pos_floating" src="edit/float.svg" tooltip="EDIT_MODE.POS_FLOATING" press="::EditModeSetPos floating" />
<PosButton id="pos_hmd" src="watch/hmd.svg" tooltip="EDIT_MODE.POS_HMD" press="::EditModeSetPos hmd" />
<PosButton id="pos_hand_l" src="watch/controller_l.svg" tooltip="EDIT_MODE.POS_HAND_L" press="::EditModeSetPos hand_l" />
<PosButton id="pos_hand_r" src="watch/controller_r.svg" tooltip="EDIT_MODE.POS_HAND_R" press="::EditModeSetPos hand_r" />
</div>
<div padding="8" gap="8" justify_content="center" align_items="center">
<label translation="EDIT_MODE.INTERPOLATION" />
<Slider id="lerp_slider" width="250" height="16" min_value="0.05" max_value="1" value="1" step="0.05" />
</div>
</div>
<div id="tab_pos" display="none">
<div height="100" flex_direction="column">
<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_anchored" src="edit/anchor.svg" tooltip="EDIT_MODE.POS_ANCHORED" press="::EditModeSetPos anchored" />
<PosButton id="pos_floating" src="edit/float.svg" tooltip="EDIT_MODE.POS_FLOATING" press="::EditModeSetPos floating" />
<PosButton id="pos_hmd" src="watch/hmd.svg" tooltip="EDIT_MODE.POS_HMD" press="::EditModeSetPos hmd" />
<PosButton id="pos_hand_l" src="watch/controller_l.svg" tooltip="EDIT_MODE.POS_HAND_L" press="::EditModeSetPos hand_l" />
<PosButton id="pos_hand_r" src="watch/controller_r.svg" tooltip="EDIT_MODE.POS_HAND_R" press="::EditModeSetPos hand_r" />
</div>
<div padding="8" gap="8" justify_content="center" align_items="center">
<label translation="EDIT_MODE.INTERPOLATION" />
<Slider id="lerp_slider" width="250" height="16" min_value="0.05" max_value="1" value="1" step="0.05" />
</div>
</div>
<div id="tab_alpha" display="none" height="100" padding="8" gap="8" justify_content="center" align_items="center">
<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" />
<CheckBox id="additive_box" translation="EDIT_MODE.BLENDING_ADDITIVE" tooltip="EDIT_MODE.ALPHA_BLEND_MODE" tooltip_side="bottom" />
</div>
<div id="tab_alpha" display="none">
<div height="100" padding="8" gap="8" justify_content="center" align_items="center">
<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" />
<CheckBox id="additive_box" translation="EDIT_MODE.BLENDING_ADDITIVE" tooltip="EDIT_MODE.ALPHA_BLEND_MODE" tooltip_side="bottom" />
<div id="tab_curve" display="none" height="100" flex_direction="column">
<div padding="8" gap="8" justify_content="center" align_items="center">
<label translation="EDIT_MODE.CURVATURE_EXPLANATION" />
</div>
</div>
<div id="tab_curve" display="none">
<div height="100" flex_direction="column">
<div padding="8" gap="8" justify_content="center" align_items="center">
<label translation="EDIT_MODE.CURVATURE_EXPLANATION" />
</div>
<div padding="8" gap="8" justify_content="center" align_items="center">
<label translation="EDIT_MODE.CURVATURE" />
<Slider id="curve_slider" width="250" height="16" min_value="0" max_value="0.5" value="0.15" step="0.01" />
</div>
<div padding="8" gap="8" justify_content="center" align_items="center">
<label translation="EDIT_MODE.CURVATURE" />
<Slider id="curve_slider" width="250" height="16" min_value="0" max_value="0.5" value="0.15" step="0.01" />
</div>
</div>
</div>

View File

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