Abstract
Creates a new base view instance.
Sets up the canvas, initializes internal state, and registers event listeners for mouse interactions and window resize events.
The HTML canvas element to render into
Protected
_canvasThe HTML canvas element for rendering
Readonly
eventsEvents fired by the view for various interactions
Fired when mouse hovers over an entity
Fired when mouse moves over the view
Fired when mouse stops hovering over an entity
Fired when the view is resized
The bounding box to include all entities in this viewer
The canvas HTML element used by this view
Abstract
centerGets the center point of the current view in world coordinates.
The view center point
Sets the center point of the current view in world coordinates.
The new center point
Postion of current mouse in world coordinate system
Postion of current mouse in screen coordinate system
Gets the input manager for handling user interactions.
The editor provides high-level methods for getting user input like point selection, entity selection, and cursor management.
The editor instance
Height of canvas (not height of window) in pixel
Abstract
missedGets information about missing data during rendering.
This includes fonts that couldn't be loaded and images that are missing or inaccessible. Implementations should track and report this information to help users understand rendering issues.
Object containing missing fonts and images
Abstract
modeGets the current view mode.
The view mode determines how the view responds to user interactions:
The current view mode
Gets the size of the selection box used for entity picking.
This determines how close the mouse needs to be to an entity to select it, measured in screen pixels.
Selection box size in pixels
Sets the size of the selection box used for entity picking.
Selection box size in pixels
The selection set in current view.
Width of canvas (not width of window) in pixel
Abstract
addAdd the specified entity in drawing database into the current scene and draw it
Input the entity to add into the current scene
Abstract
clearClear the scene
Abstract
cwcs2Converts a point from client window coordinates to world coordinates.
The client window coordinate system has its origin at the top-left corner of the canvas, with Y increasing downward. World coordinates use the CAD coordinate system with Y typically increasing upward.
Point in client window coordinates
Point in world coordinates
Abstract
highlightSelect the specified entities
Protected
Abstract
onCalled when hovering the specified entity
Protected
Abstract
onCalled when unhovering the specified entity
Protected
onAbstract
pickPick entities intersected with the specified point in the world coordinate system.
Optional
point: AcGeVector2dLikeInput the point to pick objects. If not provided, the position of current cursor is used.
Return ids of entities intersected with the specified point
Abstract
searchSearch entities intersected or contained in the specified bounding box.
Input the query bounding box
Return query results
Abstract
selectSelect entities intersected with the specified point in the world coordinate system, add them to the current selection set, and highlight them.
Optional
point: AcGeVector2dLikeAbstract
selectSelect entities intersected with the specified bounding box in the world coordinate system, add them to the current selection set, and highlight them.
Input one bounding box in the world coordinate system.
Set callback function used to calculate size of canvas when window resized
Input callback function
Abstract
setSet layer's visibility
Input layer name
Input visibility of the layer
Abstract
unhighlightUnhighlight the specified entities
Abstract
updateUpdate the specified entity
Input the entity to update
Abstract
wcs2Converts a point from world coordinates to client window coordinates.
This is the inverse of cwcs2Wcs()
, converting from the CAD world
coordinate system to screen pixel coordinates.
Point in world coordinates
Point in client window coordinates
Abstract
zoomAbstract
zoom
Abstract base class for all CAD view implementations.
This class provides the foundation for rendering and interacting with CAD drawings. It manages:
Concrete implementations must provide specific rendering logic and coordinate transformations appropriate for their rendering technology (e.g., Three.js, SVG).
Key Responsibilities
Example