forked from 1b-agent/opencadstudio-upstream
fix(ribbon): align combo panel dropdowns to a shared baseline
Style selectors (Standard, layer, Color/Linetype/Lineweight) sat at different heights across ribbon panels because each combo panel vertically centered its content: panels with fewer icon rows (Multiline Text, Table) centered their dropdown differently than panels with two rows (Dimensions, Multileader). - Pin all combo panels (Layers, Properties, style combos) to the top of the fixed 3-row panel with a shared COMBO_PANEL_PAD, so every primary dropdown shares one baseline regardless of icon-row count - Extract the duplicated tool-row and panel-container code into tool_row() / combo_panel_col() helpers + named spacing constants - Bundle the per-view render state into RenderCtx, shrinking render_large/render_large_dropdown from 12-14 positional args to (item, &ctx) - print_to_printer: silence the Windows-only dead-code warning on PrintOptions::quality with the platform split documented (the field is read by the CUPS `lp -o print-quality` path)
This commit is contained in:
1 parent
0237652963
commit
452749f58c
3 files changed
+166
-177
No files matched your search
+51
-42
@@ -1303,6 +1303,20 @@ fn render_group<'a>(
|
||||
let mut items_row: Vec<Element<Message>> = Vec::new();
|
||||
let mut small_buf: Vec<Element<Message>> = Vec::new();
|
||||
|
||||
let ctx = widgets::RenderCtx {
|
||||
active_tool,
|
||||
open_dd,
|
||||
last_cmd,
|
||||
state,
|
||||
layer_infos,
|
||||
active_layer,
|
||||
active_color,
|
||||
active_linetype,
|
||||
active_lineweight,
|
||||
style_ctx,
|
||||
compact,
|
||||
};
|
||||
|
||||
for item in &group.tools {
|
||||
let is_large = match item {
|
||||
RibbonItem::LargeTool(_) | RibbonItem::LargeDropdown { .. } => !compact,
|
||||
@@ -1314,20 +1328,7 @@ fn render_group<'a>(
|
||||
|
||||
if is_large {
|
||||
flush_small_col(&mut small_buf, &mut items_row);
|
||||
items_row.push(render_large(
|
||||
item,
|
||||
active_tool,
|
||||
open_dd,
|
||||
last_cmd,
|
||||
state,
|
||||
layer_infos,
|
||||
active_layer,
|
||||
active_color,
|
||||
active_linetype,
|
||||
active_lineweight,
|
||||
style_ctx,
|
||||
compact,
|
||||
));
|
||||
items_row.push(render_large(item, &ctx));
|
||||
} else {
|
||||
small_buf.push(render_small(
|
||||
item,
|
||||
@@ -1467,34 +1468,42 @@ fn collapse_button<'a>(
|
||||
// For a Properties panel the representative is its Match button.
|
||||
let rep = representative(group, last_used);
|
||||
let face: Element<'_, Message> = match rep {
|
||||
Some(RibbonItem::PropertiesGroup { match_prop }) => render_large(
|
||||
&RibbonItem::LargeTool(match_prop.clone()),
|
||||
active_tool,
|
||||
open_dd,
|
||||
last_cmd,
|
||||
state,
|
||||
layer_infos,
|
||||
active_layer,
|
||||
active_color,
|
||||
active_linetype,
|
||||
active_lineweight,
|
||||
style_ctx,
|
||||
false,
|
||||
),
|
||||
Some(item) => render_large(
|
||||
item,
|
||||
active_tool,
|
||||
open_dd,
|
||||
last_cmd,
|
||||
state,
|
||||
layer_infos,
|
||||
active_layer,
|
||||
active_color,
|
||||
active_linetype,
|
||||
active_lineweight,
|
||||
style_ctx,
|
||||
false,
|
||||
),
|
||||
Some(RibbonItem::PropertiesGroup { match_prop }) => {
|
||||
render_large(
|
||||
&RibbonItem::LargeTool(match_prop.clone()),
|
||||
&widgets::RenderCtx {
|
||||
active_tool,
|
||||
open_dd,
|
||||
last_cmd,
|
||||
state,
|
||||
layer_infos,
|
||||
active_layer,
|
||||
active_color,
|
||||
active_linetype,
|
||||
active_lineweight,
|
||||
style_ctx,
|
||||
compact: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
Some(item) => {
|
||||
render_large(
|
||||
item,
|
||||
&widgets::RenderCtx {
|
||||
active_tool,
|
||||
open_dd,
|
||||
last_cmd,
|
||||
state,
|
||||
layer_infos,
|
||||
active_layer,
|
||||
active_color,
|
||||
active_linetype,
|
||||
active_lineweight,
|
||||
style_ctx,
|
||||
compact: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
None => text("").into(),
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user