ToolView
What a tool’s draw function and overlays draw with. A tool’s draw takes points in the
coordinates of the context being edited, like its events’ ToolPoint.position, and
Modlumi maps them to the model. Overlays from PluginContext.addOverlay take model
coordinates. Either takes screen pixels instead with screen: true.
Methods
Section titled “Methods”box(
origin,size,style?):void
The twelve edges of a box with one corner at origin and size along X, Y and Z, placed by
transformation when given, such as a group’s. Needs the "previewBoxes" feature.
Parameters
Section titled “Parameters”origin
Section titled “origin”style?
Section titled “style?”Omit<PreviewStyle, "screen"> & object
Returns
Section titled “Returns”void
image()
Section titled “image()”image(
image,corners,style?):void
An image stretched over four corners: its top left, top right, bottom right and bottom
left. In model coordinates the image bends with the perspective; with screen: true the
corners are screen pixels, as for a photo to match the model to. Images draw over the
model and the other shapes, at opacity from 0 to 1.
Parameters
Section titled “Parameters”corners
Section titled “corners”readonly [Point3dLike | readonly [number, number], Point3dLike | readonly [number, number], Point3dLike | readonly [number, number], Point3dLike | readonly [number, number]]
style?
Section titled “style?”opacity?
Section titled “opacity?”number
screen?
Section titled “screen?”boolean
Returns
Section titled “Returns”void
Example
Section titled “Example”// Shows a photo over the top left of the viewport, half see-through.const photo = context.loadImage("site.jpg");context.addOverlay((view) => { const [w, h] = [photo.width / 4, photo.height / 4]; view.image(photo, [[20, 60], [20 + w, 60], [20 + w, 60 + h], [20, 60 + h]], { screen: true, opacity: 0.5 });});lines()
Section titled “lines()”lines(
points,style?):void
Separate segments, one from each pair of points.
Parameters
Section titled “Parameters”points
Section titled “points”Iterable<Point3dLike | readonly [number, number]>
style?
Section titled “style?”Returns
Section titled “Returns”void
points()
Section titled “points()”points(
points,style?):void
Parameters
Section titled “Parameters”points
Section titled “points”Iterable<Point3dLike | readonly [number, number]>
style?
Section titled “style?”Returns
Section titled “Returns”void
polygon()
Section titled “polygon()”polygon(
points,style?):void
A filled convex polygon.
Parameters
Section titled “Parameters”points
Section titled “points”Iterable<Point3dLike | readonly [number, number]>
style?
Section titled “style?”Returns
Section titled “Returns”void
polyline()
Section titled “polyline()”polyline(
points,style?):void
Parameters
Section titled “Parameters”points
Section titled “points”Iterable<Point3dLike | readonly [number, number]>
style?
Section titled “style?”Returns
Section titled “Returns”void
text()
Section titled “text()”text(
position,text,style?):void
Text at a point, or at screen pixels.
Parameters
Section titled “Parameters”position
Section titled “position”Point3dLike | readonly [number, number]
unknown
style?
Section titled “style?”Returns
Section titled “Returns”void