diff --git a/crates/openpencil-shell-core/src/widgets/mod.rs b/crates/openpencil-shell-core/src/widgets/mod.rs index 3205bc639..29e9d6dd4 100644 --- a/crates/openpencil-shell-core/src/widgets/mod.rs +++ b/crates/openpencil-shell-core/src/widgets/mod.rs @@ -17,6 +17,15 @@ use crate::{Point2D, Rect, RenderBackend}; +/// Minimum width (in CSS / physical px) below which the editor-UI +/// host paints the Toolbar only and skips the LayerPanel / +/// CanvasViewport / PropertyPanel rails. Single canonical +/// definition consumed by both `openpencil-shell-web::WidgetHost` +/// and `openpencil-shell-native::WidgetHostNative` so they stay in +/// lock-step (codex Step 3 R1 BLOCK fix — was duplicated as +/// `const MIN_RAIL_WIDTH` in each host). +pub const MIN_RAIL_WIDTH: f32 = 80.0; + // Phase B primitives. pub mod dropdown; pub mod prop_row; diff --git a/crates/openpencil-shell-native/src/widget_host.rs b/crates/openpencil-shell-native/src/widget_host.rs index 4ab6378b0..3a59ce032 100644 --- a/crates/openpencil-shell-native/src/widget_host.rs +++ b/crates/openpencil-shell-native/src/widget_host.rs @@ -52,16 +52,10 @@ use crate::backend::NativeBackend; use openpencil_shell_core::document::Document; use openpencil_shell_core::widgets::{ - CanvasViewport, LayerPanel, LayoutCx, PaintCx, PropertyPanel, Toolbar, Widget, + CanvasViewport, LayerPanel, LayoutCx, PaintCx, PropertyPanel, Toolbar, Widget, MIN_RAIL_WIDTH, }; use openpencil_shell_core::{Color, Point2D, Rect, RenderBackend, TextLayout}; -/// Below this viewport width (in physical px) we paint the Toolbar -/// only and skip both rails. Mirrors shell-web's `MIN_RAIL_WIDTH` -/// constant so cross-platform behaviour at narrow viewports stays -/// in sync. Codex Step 2 R1 CONCERN-3. -const MIN_RAIL_WIDTH: f32 = 80.0; - /// Frame-scoped `RenderBackend` adapter over `NativeBackend` + /// `&Canvas`. Lifetime-bound to the `SharedSkiaContext::with_frame` /// closure body so widget code never sees the canvas borrow directly. diff --git a/crates/openpencil-shell-web/src/widget_host.rs b/crates/openpencil-shell-web/src/widget_host.rs index ae0bdd4be..681b331f8 100644 --- a/crates/openpencil-shell-web/src/widget_host.rs +++ b/crates/openpencil-shell-web/src/widget_host.rs @@ -24,17 +24,10 @@ use crate::backend::WebBackend; use openpencil_shell_core::document::Document; use openpencil_shell_core::widgets::{ - CanvasViewport, LayerPanel, LayoutCx, PaintCx, PropertyPanel, Toolbar, Widget, + CanvasViewport, LayerPanel, LayoutCx, PaintCx, PropertyPanel, Toolbar, Widget, MIN_RAIL_WIDTH, }; use openpencil_shell_core::{Point2D, Rect, RenderBackend}; -/// Below this viewport width (in CSS px) we paint the Toolbar -/// only and skip both rails — there's not enough horizontal -/// space for a usable LayerPanel + PropertyPanel split. Codex -/// Step 2 R1 CONCERN-3: clamp `rail_w` to non-negative AND skip -/// when too small to be useful. -const MIN_RAIL_WIDTH: f32 = 80.0; - /// The Step 3 editor-UI host. Owns the document model + toolbar /// tool selection; per-frame builds LayerPanel / PropertyPanel / /// CanvasViewport from the document. Aux Dropdown / TextInput