Marker Class

A Marker is a CanvasDecoration, whose position follows a fixed location in world space. Markers draw on top of all scene graphics, and show visual cues about locations of interest.

@see Markers

Implements

Methods

Name Description
constructor(worldLocation: Readonly<WritableXYAndZ>, size: Readonly<WritableXAndY>): Marker Constructor for Marker  
addDecoration(context: DecorateContext): void Set the position and add this Marker to the supplied DecorateContext, if it's visible.  
addMarker(context: DecorateContext): void Add this Marker to the supplied DecorateContext.  
drawDecoration(ctx: CanvasRenderingContext2D): void Called during frame rendering to display this Marker onto the supplied context.  
drawFunc(ctx: CanvasRenderingContext2D): void Optional Implement this function to draw onto the CanvasRenderingContext2D when this Marker is displayed.  
drawHilited(ctx: CanvasRenderingContext2D): boolean Protected When a Marker is displayed in its hilited state, this method is called first.  
onMouseButton(_ev: BeButtonEvent): boolean Optional Called when a mouse button is pressed over this Marker.  
onMouseEnter(ev: BeButtonEvent): void Called when the mouse pointer enters this Marker.  
onMouseLeave(): void Called when the mouse pointer leaves this Marker.  
onMouseMove(ev: BeButtonEvent): void Called when the mouse pointer moves over this Marker  
pick(pt: Readonly<WritableXAndY>): boolean Determine whether the point is within this Marker.  
positionHtml(): void Protected Position the HTMLElement for this Marker relative to the Marker's position in the view.  
setImage(image: MarkerImage | Promise<MarkerImage>): void Set the image for this marker.  
setImageUrl(url: string): void Set the image for this Marker from a URL.  
setPosition(vp: Viewport, markerSet?: MarkerSet<Marker>): boolean Set the position (in pixels) for this Marker in the supplied Viewport, based on its worldLocation.  
setScaleFactor(range: Range1dProps): void Establish a range of scale factors to increases and decrease the size of this Marker based on its distance from the camera.  
makeFrom<T extends Marker>(other: Marker, ...args: any[]): T Static Make a new Marker at the same position and size as this Marker.  

Properties

Name Type Description
_hiliteColor Protected ColorDef | undefined The color for the shadowBlur when this Marker is hilited  
_isHilited Protected boolean Whether this marker is currently hilited or not.  
_scaleFactor Protected Point2d | undefined    
_scaleFactorRange Protected Range1d | undefined    
htmlElement HTMLElement | undefined An Optional (unique) HTMLElement to display with this Marker.  
image MarkerImage | undefined An image to draw for this Marker.  
imageOffset Readonly<WritableXAndY> | undefined The offset for image, in pixels, from the center of this Marker.  
imageSize Readonly<WritableXAndY> | undefined The size of image, in pixels.  
label string | undefined A text Label for this Marker.  
labelAlign MarkerTextAlign | undefined The text alignment for label.  
labelBaseline MarkerTextBaseline | undefined The text baseline for label.  
labelColor MarkerFillStyle | undefined The color for label.  
labelFont string | undefined The font for label.  
labelMaxWidth number | undefined The maximum with for label, in pixels.  
labelOffset Readonly<WritableXAndY> | undefined The offset for label, in pixels, from the center of this Marker.  
position Point3d The current position for the marker, in view coordinates (pixels).  
rect Readonly ViewRect The current rectangle for the marker, in view coordinates (pixels).  
size Point2d The size of this Marker, in pixels.  
title string | HTMLElement The title string, or HTMLElement, to show (only) in the ToolTip when the pointer is over this Marker.  
tooltipOptions ToolTipOptions | undefined The ToolTipOptions to use for title.  
visible boolean Whether this marker is currently enabled.  
wantImage Accessor ReadOnly boolean Return true to display image, if present.  
worldLocation Point3d The location of this Marker in world coordinates.  

Defined in

Last Updated: 17 July, 2024