Frameworks
Integrations
Mendix
SharePoint
Default UI
Modular UI
AnnotationManager
Annotation Types
Customize
Version 11
Version 10
v10.12
v10.11
v10.10
v10.9
v10.8
v10.7
v10.6
v10.5
v10.4
v10.3
v10.2
v10.1
v10.0
Version 8
v8.12
v8.11
v8.10
v8.9
v8.8
v8.7
v8.6
v8.5
v8.4
v8.3
v8.2
v8.1
v8.0
Version 7
Version 6
v6.3
v6.2
v6.1
v6.0
Version 5
Version 4
Version 3
Version 2
WebViewer Server
WebViewer BIM
Annotations take up a certain amount of space on a document page. Their "body" in the document is commonly represented as a rectangle or an array of rectangles. These rectangles are provided as either a Rect
or Quad
object in WebViewer.
Most annotations will use a Rect
as their body, whereas Quad
objects are typically for annotations that mark up text. With a Quad
, you can convert it to a Rect
and vice-versa. With a Rect
, you can get more information from the shape such as its dimensions or checking for intersections with other rectangles.
Most annotations will work with Rect
objects. Specifically for resizing through the use of setRect
.
There are two APIs for collision detection. You can use either intersect
or contains
with another rectangle to check if the two rectangle bodies overlap. The difference, however, is that contains
strictly checks whether one rectangle is inside another.
Occasionally, you may need to transform a rectangle a certain way or perhaps you need a special transformation for your custom annotation. In this case, you can transform a Rect
with a Matrix
.
However, matrices are difficult to work with and are not easily recognizable. WebViewer provides a TransformationBuilder
to assist in building a transformation out. The operations you set with the TransformationBuilder
is in the order you would perform them (not in reverse order).
If you want to use the transformation matrix with the Canvas context, you can use the toTransform
API on the Matrix
to get an array of values to be used with setTransform
on the context.
Quads
are commonly found with annotations that mark up text. In many of the cases, these annotations, like HighlightAnnotation
, contain a list of Quad
objects representing the lines of text that are marked.
Rect
Quad
objects are limited in functionality, but you can convert them to a Rect
where you will gain access to its APIs. After you are done, you can convert it back to a Quad
.
To convert it back:
See how Rect
and Quad
objects are used in some of our annotation guides, specifically RectangleAnnotation
and HighlightAnnotation
!
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales