feat(viewport): draggable Model-tile dividers
Tiled Model layouts now show the inner edges between panes as 2-px
dividers that act as resize grips: cursor on a divider → resize cue,
press + drag moves the edge (with every tile sharing that edge
updating together), release runs a collapse pass that absorbs any
tile that fell below the viewcube-comfort minimum into the neighbour
with the longest shared contact edge — drag a divider all the way
across to remove a pane.
- Scene grows `model_tile_edges`, `hit_model_tile_edge`,
`move_model_tile_edge`, `collapse_small_model_tiles`. Edges are
derived from the existing `model_tiles` rects (no extra storage).
- App carries a `tile_drag` Option; `ViewportLeftPress` starts it
ahead of tile activation / picking, `ViewportMove` drives the
edge, `ViewportLeftRelease` collapses + clears.
- `SelectionCanvas` draws the dividers and switches the cursor to
`Resizing{Horizontally, Vertically}` over them.
This commit is contained in:
parent
e3c962bdd1
commit
39eab9a4c4
5 changed files with 550 additions and 2 deletions
|
|
@ -11,7 +11,18 @@ mod view;
|
|||
use document::DocumentTab;
|
||||
|
||||
use crate::modules::ModuleEvent;
|
||||
use crate::scene::CubeRegion;
|
||||
use crate::scene::{CubeRegion, TileEdgeOrient};
|
||||
|
||||
/// In-flight drag of a Model-tile inner divider. `last_applied` is the
|
||||
/// most recent normalized coordinate handed to `move_model_tile_edge` —
|
||||
/// the next `ViewportMove` uses it as the `old_coord` argument so the
|
||||
/// drag follows the same edge across frames even after sub-pixel
|
||||
/// adjustments from the clamp inside `move_model_tile_edge`.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct TileDrag {
|
||||
pub orient: TileEdgeOrient,
|
||||
pub last_applied: f32,
|
||||
}
|
||||
use crate::snap::Snapper;
|
||||
use crate::ui::{AppMenu, CommandLine, Ribbon, StatusBar};
|
||||
use acadrust::types::{Color as AcadColor, LineWeight};
|
||||
|
|
@ -73,6 +84,10 @@ pub(super) struct OpenCADStudio {
|
|||
/// `true` after a bare `VPORTS` in model space — the next command-line
|
||||
/// entry is treated as the tiled-config option (SIngle/2H/2V/4).
|
||||
awaiting_vports: bool,
|
||||
/// Active drag of a Model-tile divider. Set on press over an inner
|
||||
/// edge, updated on move, cleared on release (which also runs the
|
||||
/// collapse pass).
|
||||
tile_drag: Option<TileDrag>,
|
||||
/// Show the UCS icon in the bottom-left corner of model space (UCSICON).
|
||||
show_ucs_icon: bool,
|
||||
/// Whether the ViewCube 3D gizmo is visible in model space (NAVVCUBE).
|
||||
|
|
@ -747,6 +762,7 @@ impl OpenCADStudio {
|
|||
show_grid: false,
|
||||
dyn_input: true,
|
||||
awaiting_vports: false,
|
||||
tile_drag: None,
|
||||
show_ucs_icon: true,
|
||||
show_viewcube: true,
|
||||
show_properties: true,
|
||||
|
|
|
|||
Loading…
Reference in a new issue