pub struct WidgetRegistry {
pub viewcube_enabled: bool,
/* private fields */
}Expand description
The engine-side widget registry (one per engine).
Fields§
§viewcube_enabled: boolThe ViewCube is always-on once enabled by the host UI (its retired counterpart is deleted in the same change set).
Implementations§
Source§impl WidgetRegistry
impl WidgetRegistry
pub fn new() -> Self
Sourcepub fn has_main_overlay(&self) -> bool
pub fn has_main_overlay(&self) -> bool
Any main-overlay widget geometry present (excludes the ViewCube, which draws in its own pass).
Sourcepub fn overlay_groups_bbox(&self) -> Aabb
pub fn overlay_groups_bbox(&self) -> Aabb
World-space AABB of the pushed overlay GROUPS — the set_overlay geometry
(the sketch curves + points, dimension leaders, constraint glyphs, datums,
curves). EXCLUDES the screen-constant transform gizmo + ViewCube (own passes).
Folded into the camera depth-range fit so orbiting an editing sketch doesn’t
clip the overlay against the SOLIDS-ONLY scene bounds (the reported
sketch-clipping bug when “Lock to sketch” is off). Empty when no groups.
Sourcepub fn set_datums_json(&mut self, json: &str) -> Result<(), String>
pub fn set_datums_json(&mut self, json: &str) -> Result<(), String>
Replace the datum / curve display set. Shape:
{planes:[{name,origin,x,y,size?,color?,selected?,hovered?}], axes:[{name,point,direction,length,color?,selected?,hovered?}], frames:[{origin,x,y,z,px?}], curves:[{points:[[x,y,z]...],closed?,color?,selected?,hovered?}]}.
Sourcepub fn set_overlay_json(&mut self, json: &str) -> Result<(), String>
pub fn set_overlay_json(&mut self, json: &str) -> Result<(), String>
Replace/upsert the GENERAL overlay geometry channel (set_overlay).
Shape: {groups:[{name, renderOrder?, tris:{positions,colors,normals?}, lines:{positions,colors}, points?:{positions,colors,size?}}]}. Each group
UPSERTS by name; a group whose geometry is entirely empty REMOVES that
name; an empty (or missing) groups array CLEARS every group.
Sourcepub fn overlay_group_names(&self) -> Vec<&str>
pub fn overlay_group_names(&self) -> Vec<&str>
The names of the currently-loaded (non-empty) general overlay groups — a read accessor for tests / verification. An empty group is auto-removed on upsert, so a name present here always carries geometry.
Sourcepub fn datum_plane_names(&self) -> Vec<(&str, bool)>
pub fn datum_plane_names(&self) -> Vec<(&str, bool)>
The currently-fed datum PLANES as (name, emphasized) — a read accessor for
tests / verification (the datum planes replace their set wholesale each
set_datums_json, so this is exactly the current construction-datum feed).
emphasized is the selected/hovered hot flag (a selected datum reads true).
Sourcepub fn set_dimensions_json(&mut self, json: &str) -> Result<(), String>
pub fn set_dimensions_json(&mut self, json: &str) -> Result<(), String>
Replace the feature-dimension set. Shape: an array of
{id, type:"linear"|"angular"|"radial", ...} — linear: a,b,offsetDir, offset; angular: vertex,dirA,dirB,radius; radial: center,pointOnCircle.
Sourcepub fn set_transform_json(&mut self, json: &str) -> Result<(), String>
pub fn set_transform_json(&mut self, json: &str) -> Result<(), String>
Set (or clear, when json == "null") the transform gizmo. Shape:
{origin,x,y,z,showCenter?} — the selected feature’s frame (R28).
pub fn set_viewcube_enabled(&mut self, enabled: bool)
Sourcepub fn build_main_overlay(&self, cam: &GizmoCamera) -> Overlay
pub fn build_main_overlay(&self, cam: &GizmoCamera) -> Overlay
Build the main-overlay geometry (everything but the ViewCube).
Sourcepub fn dimension_anchors(&self, cam: &GizmoCamera) -> Vec<(String, [f32; 3])>
pub fn dimension_anchors(&self, cam: &GizmoCamera) -> Vec<(String, [f32; 3])>
(id, world label anchor) for every dimension — the host projects
each with world_to_screen to place its text label (R29).
Sourcepub fn any_visible(&self) -> bool
pub fn any_visible(&self) -> bool
Any overlay widget is present (main geometry or the ViewCube).
Sourcepub fn build_overlay(&self, cam: &GizmoCamera) -> WidgetOverlay
pub fn build_overlay(&self, cam: &GizmoCamera) -> WidgetOverlay
Build a whole frame’s overlay geometry from the live camera.
Sourcepub fn build_viewcube(&self, cam: &GizmoCamera) -> Option<ViewCubeFrame>
pub fn build_viewcube(&self, cam: &GizmoCamera) -> Option<ViewCubeFrame>
The ViewCube render frame (overlay + mini-camera + corner rect), or None when disabled.
Sourcepub fn viewcube_rect(&self, cam: &GizmoCamera) -> [f32; 4]
pub fn viewcube_rect(&self, cam: &GizmoCamera) -> [f32; 4]
The ViewCube corner rect [x, y, w, h] (CSS px) — the host decides
whether to forward a pointer event and offsets it into cube-local coords.
Sourcepub fn viewcube_hit(
&self,
cam: &GizmoCamera,
local_x: f32,
local_y: f32,
) -> Option<HandleId>
pub fn viewcube_hit( &self, cam: &GizmoCamera, local_x: f32, local_y: f32, ) -> Option<HandleId>
Hit-test the ViewCube at cube-local pixels; returns the region handle.
Sourcepub fn set_viewcube_hover(&mut self, handle: Option<HandleId>) -> bool
pub fn set_viewcube_hover(&mut self, handle: Option<HandleId>) -> bool
Set the ViewCube hover region (drives the highlight). Returns whether it changed.
Sourcepub fn viewcube_target(&self, handle: HandleId) -> ([f32; 3], [f32; 3])
pub fn viewcube_target(&self, handle: HandleId) -> ([f32; 3], [f32; 3])
The world eye→target look direction + up hint for a ViewCube region.
Sourcepub fn datum_pick(&self, cam: &GizmoCamera, x: f32, y: f32) -> Option<String>
pub fn datum_pick(&self, cam: &GizmoCamera, x: f32, y: f32) -> Option<String>
Pick the datum plane/axis under a screen pixel; returns its name.
pub fn has_transform(&self) -> bool
Sourcepub fn transform_origin(&self) -> Option<[f32; 3]>
pub fn transform_origin(&self) -> Option<[f32; 3]>
The VISIBLE transform gizmo’s current frame origin in world space, or None
when the gizmo is hidden. Reflects the last [set_transform_json] feed, so
it tracks the live-follow re-sync during a drag (Fix 3) — distinct from a
params-derived anchor, this proves the drawn widget actually moved.
Sourcepub fn transform_hit(&self, cam: &GizmoCamera, x: f32, y: f32) -> HandleId
pub fn transform_hit(&self, cam: &GizmoCamera, x: f32, y: f32) -> HandleId
Hit-test the transform gizmo; returns the handle (0 = none).
pub fn set_transform_hover(&mut self, handle: HandleId) -> bool
pub fn set_transform_active(&mut self, handle: HandleId)
Sourcepub fn transform_drag_json(
&self,
cam: &GizmoCamera,
handle: HandleId,
sx: f32,
sy: f32,
cx: f32,
cy: f32,
) -> String
pub fn transform_drag_json( &self, cam: &GizmoCamera, handle: HandleId, sx: f32, sy: f32, cx: f32, cy: f32, ) -> String
Compute a transform drag: frame-space delta + its world resolution, as
JSON for the host’s feature-edit commit (R28). Resolved against the LIVE gizmo
frame (self.transform).
Sourcepub fn transform_drag_json_with_frame(
&self,
cam: &GizmoCamera,
frame_json: &str,
handle: HandleId,
sx: f32,
sy: f32,
cx: f32,
cy: f32,
) -> String
pub fn transform_drag_json_with_frame( &self, cam: &GizmoCamera, frame_json: &str, handle: HandleId, sx: f32, sy: f32, cx: f32, cy: f32, ) -> String
Like [transform_drag_json] but resolved against an EXPLICIT frozen frame
({origin,x,y,z}, the grab-time feature frame) instead of the live widget
gizmo. This lets the engine re-sync the VISIBLE gizmo to the moving feature
pose every drag frame (Fix 3 live-follow) while the delta stays anchored to
the grab frame, so the visual sync can’t feed back into the drag math.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WidgetRegistry
impl RefUnwindSafe for WidgetRegistry
impl Send for WidgetRegistry
impl Sync for WidgetRegistry
impl Unpin for WidgetRegistry
impl UnsafeUnpin for WidgetRegistry
impl UnwindSafe for WidgetRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more