forked from 1b-agent/opencadstudio-upstream
View backgrounds: image colours as stored, viewport style name, adjust automation
- The background image texture is not an sRGB view: the image is drawn with its own colours, as the solid and gradient colours are. - An entered paper-space viewport shows its named visual style (Realistic, ...) in the render-mode picker, and a mode picked there is recorded as the viewport's visual style. - The view_background automation action takes offset=x,y and scale=x,y. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
b5b505ee9d
commit
064da8829e
8 files changed
+80
-19
No files matched your search
+20
-13
@@ -182,6 +182,24 @@ impl std::fmt::Display for RenderModeChoice {
|
||||
}
|
||||
}
|
||||
|
||||
/// A named style (Realistic, …) the active viewport draws as, by name.
|
||||
fn named_visual_style(
|
||||
scene: &crate::scene::Scene,
|
||||
mode: codec::entities::ViewportRenderMode,
|
||||
) -> Option<String> {
|
||||
match scene.document.objects.get(&scene.active_visual_style()) {
|
||||
Some(codec::objects::ObjectType::VisualStyle(style)) => {
|
||||
match crate::modules::view::visual_style::mode_for_style_name(&style.description) {
|
||||
Some((named_mode, true)) if named_mode == mode => {
|
||||
Some(crate::t!(style.description.as_str()).into_owned())
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
impl OpenCADStudio {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn view(&self, window_id: window::Id) -> Element<'_, Message> {
|
||||
@@ -1297,18 +1315,7 @@ bg={bg_ms:.1}ms n={view_count}"
|
||||
let rect = tab.scene.active_model_tile_bounds(vw, vh);
|
||||
// Unified control chip: split buttons + render-mode picker +
|
||||
// grid / grid-snap toggles, for the active Model tile.
|
||||
// A named style (Realistic, …) the tile draws as shows by name.
|
||||
let style_name = match tab.scene.document.objects.get(&tab.scene.active_visual_style()) {
|
||||
Some(codec::objects::ObjectType::VisualStyle(style)) => {
|
||||
match crate::modules::view::visual_style::mode_for_style_name(&style.description) {
|
||||
Some((mode, true)) if mode == tab.render_mode => {
|
||||
Some(crate::t!(style.description.as_str()).into_owned())
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
let style_name = named_visual_style(&tab.scene, tab.render_mode);
|
||||
let bar = viewport_controls(
|
||||
tab.render_mode,
|
||||
self.show_grid,
|
||||
@@ -1410,7 +1417,7 @@ bg={bg_ms:.1}ms n={view_count}"
|
||||
0,
|
||||
self.render_mode_menu_open,
|
||||
self.render_mode_preview,
|
||||
None,
|
||||
named_visual_style(&tab.scene, vp_mode),
|
||||
);
|
||||
let adaptive: Element<'_, Message> = DensitySwap::new(vec![
|
||||
iced::widget::opaque(bar),
|
||||
|
||||
Reference in new issue
Block a user