ToolView
What a tool’s draw function draws its preview with.
Methods
Section titled “Methods”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