diff --git a/src/app/view/mod.rs b/src/app/view/mod.rs index 0a9a75b88..28b32f37b 100644 --- a/src/app/view/mod.rs +++ b/src/app/view/mod.rs @@ -32,6 +32,12 @@ use viewcube::{viewcube_nav_controls, viewcube_ucs_picker, UCS_PICKER_W}; pub(in crate::app) use overlay::{MTEXT_TEXT_ID, TEXT_INLINE_ID}; const VIEWCUBE_HIT_SIZE: f32 = VIEWCUBE_REGION_PX; +const PAPER_SPACE_BACKGROUND: Color = Color { + r: 138.0 / 255.0, + g: 138.0 / 255.0, + b: 138.0 / 255.0, + a: 1.0, +}; /// Clear gap (px) kept between the render-mode bar (top-left) and the ViewCube /// (top-right) before the cube is judged to collide and hides. @@ -574,6 +580,11 @@ impl OpenCADStudio { tab.pan_mode, self.ribbon.open_dropdown.is_some(), hover_locked, + if tab.scene.input_uses_model_space() { + tab.scene.bg_color + } else { + tab.scene.paper_bg_color + }, ) }; @@ -591,13 +602,7 @@ impl OpenCADStudio { .on_exit(Message::ViewportExit); let bg_color = if is_paper { - // Desk color — matches the DESK constant in paper_canvas.rs. - Color { - r: 0.22, - g: 0.24, - b: 0.28, - a: 1.0, - } + PAPER_SPACE_BACKGROUND } else { tab.bg_color .map(|[r, g, b, a]| Color { r, g, b, a }) @@ -706,16 +711,10 @@ impl OpenCADStudio { // container background, the white sheet + paper entities + borders // come from the full-canvas top-locked "sheet" viewport, and the // floating content viewports overlay it (same path as model space). - const DESK: Color = Color { - r: 0.22, - g: 0.24, - b: 0.28, - a: 1.0, - }; stack![ container(grid_overlay) .style(move |_: &Theme| container::Style { - background: Some(Background::Color(DESK)), + background: Some(Background::Color(PAPER_SPACE_BACKGROUND)), ..Default::default() }) .width(Fill) diff --git a/src/ui/overlay.rs b/src/ui/overlay.rs index 3cdc35022..2969c4006 100644 --- a/src/ui/overlay.rs +++ b/src/ui/overlay.rs @@ -220,6 +220,7 @@ pub fn selection_overlay<'a>( pan_mode: bool, suppressed: bool, hover_locked: bool, + crosshair_bg: [f32; 4], ) -> Element<'a, Message> { canvas(SelectionCanvas { selection, @@ -239,6 +240,7 @@ pub fn selection_overlay<'a>( pan_mode, suppressed, hover_locked, + crosshair_bg, }) .width(Length::Fill) .height(Length::Fill) @@ -290,6 +292,9 @@ struct SelectionCanvas { /// The entity under the crosshair is on a locked layer — draw a small lock /// badge by the cursor so the user knows it can't be selected/edited. hover_locked: bool, + /// Background of the active drawing space. Crosshair contrast follows this + /// rather than the UI theme, which may be light over a dark model viewport. + crosshair_bg: [f32; 4], } fn draw_grip_marker(frame: &mut canvas::Frame, grip: &GripMarker, theme: &Theme) { @@ -908,12 +913,11 @@ impl canvas::Program for SelectionCanvas { // PAN mode replaces the crosshair with a hand cursor. if !over_viewcube && !over_divider && !self.pan_mode && !self.suppressed { if let Some(cp) = self.selection.last_move_pos { - let color = theme - .palette() - .background - .base - .text - .scale_alpha(0.90); + let [r, g, b, a] = crate::scene::view::render::adapt_to_bg( + [1.0, 1.0, 1.0, 0.90], + self.crosshair_bg, + ); + let color = Color { r, g, b, a }; let stroke = canvas::Stroke { width: 1.0, style: canvas::Style::Solid(color),