Skip to main content

WidgetRegistry

Struct WidgetRegistry 

Source
pub struct WidgetRegistry {
    pub viewcube_enabled: bool,
    /* private fields */
}
Expand description

The engine-side widget registry (one per engine).

Fields§

§viewcube_enabled: bool

The ViewCube is always-on once enabled by the host UI (its retired counterpart is deleted in the same change set).

Implementations§

Source§

impl WidgetRegistry

Source

pub fn new() -> Self

Source

pub fn has_main_overlay(&self) -> bool

Any main-overlay widget geometry present (excludes the ViewCube, which draws in its own pass).

Source

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.

Source

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?}]}.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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?,showAxes?,showRings?} — the selected feature’s frame (R28); the optional show flags (default true) carve the translate-only / rotate-only variants the component Move toggle cycles.

Source

pub fn set_viewcube_enabled(&mut self, enabled: bool)

Source

pub fn set_viewcube_size(&mut self, size_px: f32)

Set the ViewCube’s on-screen edge length (CSS px). ONE size field feeds both the rendered mini-camera viewport (build_viewcube) and the hit-test corner rect (viewcube_rect), so the drawn cube and its clickable region always scale together. Driven from RenderSettings::viewcube_size_px on every settings apply. Guarded to a >= 1px positive size so a bad feed can’t collapse the rect.

Source

pub fn build_main_overlay(&self, cam: &GizmoCamera) -> (Overlay, usize)

Build the main-overlay geometry (everything but the ViewCube). Build the main overlay geometry AND the count of leading tri vertices that belong to the datum/construction PLANES (always emitted FIRST). The render core draws those with a NO-depth-write pipeline so a translucent plane can never occlude the gizmos/dimensions that follow.

Source

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).

Source

pub fn any_visible(&self) -> bool

Any overlay widget is present (main geometry or the ViewCube).

Source

pub fn build_overlay(&self, cam: &GizmoCamera) -> WidgetOverlay

Build a whole frame’s overlay geometry from the live camera.

Source

pub fn build_viewcube(&self, cam: &GizmoCamera) -> Option<ViewCubeFrame>

The ViewCube render frame (overlay + mini-camera + corner rect), or None when disabled.

Source

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.

Source

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.

Source

pub fn set_viewcube_hover(&mut self, handle: Option<HandleId>) -> bool

Set the ViewCube hover region (drives the highlight). Returns whether it changed.

Source

pub fn viewcube_target(&self, handle: HandleId) -> ([f32; 3], [f32; 3])

The world eye→target look direction + up hint for a ViewCube region.

Source

pub fn datum_plane_hits( &self, cam: &GizmoCamera, x: f32, y: f32, ) -> Vec<(String, [f32; 3])>

EVERY fed datum PLANE whose DRAWN card the pointer ray crosses, as (name, world hit point) — the multi-hit sibling of datum_pick, which stops at the first hit and also considers axes.

The bound is the rectangle the renderer draws, not the infinite plane: DatumPlane::hit_point is the same half() extent build_main_overlay draws with, evaluated against the LIVE camera on every call — so a screen-constant card’s pickable region tracks its drawn size across a zoom (nothing is baked). Either face of the card hits. Unnamed planes are skipped (nothing could be selected by them).

The engine turns these into PickKind::Plane candidates so a construction plane competes in the ordinary pick list instead of only on a geometry miss (see EngineState::pick_candidates_at).

Source

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.

Source

pub fn has_transform(&self) -> bool

Source

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.

Source

pub fn transform_hit(&self, cam: &GizmoCamera, x: f32, y: f32) -> HandleId

Hit-test the transform gizmo; returns the handle (0 = none).

Source

pub fn transform_axis_seg( &self, cam: &GizmoCamera, i: usize, ) -> Option<(Vec3, Vec3)>

The world-space (shaft-start, tip) endpoints of axis arrow i on the LIVE transform gizmo — the SAME instance + axis_seg the hit test (transform_hitTransformGizmo::hit) measures against — so a debug overlay can outline the exact pickable region without re-deriving it. None when the gizmo is hidden.

Source

pub fn transform_center_grab(&self) -> Option<Vec3>

The world-space center free-move / origin ball point of the LIVE transform gizmo, or None when hidden / the center handle is off. For the debug hit-area outline (radius brep_gizmos::transform::PX_CENTER_RAD).

Source

pub fn transform_ring_grabs(&self, cam: &GizmoCamera) -> Option<[Vec3; 3]>

The three rotation grab-sphere world points of the LIVE transform gizmo (in ARCS order), or None when hidden. For the debug hit-area outline (radius brep_gizmos::transform::PX_RING_GRAB_RAD).

Source

pub fn transform_hit_regions( &self, cam: &GizmoCamera, ) -> Vec<(HandleId, HitShape)>

The authoritative screen-space pickable regions of the LIVE transform gizmo — the SAME hit_regions TransformGizmo::hit consumes — each paired with its handle. [] when the gizmo is hidden. The debug-outline exposer serializes these, so the drawn region IS exactly the pickable region.

Source

pub fn set_transform_hover(&mut self, handle: HandleId) -> bool

Source

pub fn set_transform_active(&mut self, handle: HandleId)

Source

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).

Source

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§

Source§

impl Default for WidgetRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,