StaticALLOW_Whether annotations can be dragged outside the page (off by default: dragging stops at the page edge and does not move in a direction where the annotation is larger than the page).
Whether annotations can be dragged outside the page (off by default: dragging stops at the page edge and does not move in a direction where the annotation is larger than the page).
With the link tool on, pressing a hand-drawn link selects, drags and resizes it (otherwise a click follows it).
Creates a tool that creates text markup annotations over selected text (red by default).
The document viewer the tool works on.
OptionalannotationPrototype: AnnotationClass
Class of the annotations to create; TextHighlightAnnotation by default.
StaticallowAllows annotations to be dragged outside the page (sets ALLOW_ANNOTS_OUTSIDE_PAGE to true).
Called when the context menu is requested on the viewer; does nothing in the base class.
The mouse event.
StaticdisableTurns off hover cursors: the tool's own cursor is always used (sets ENABLE_ANNOTATION_HOVER_CURSORS to false).
StaticdisableTurns off automatic text selection by the edit tool (sets ENABLE_AUTO_SWITCH to false).
Selects an annotation when the press is released (the default); the press does not drag it.
Disallows selecting text with this tool.
StaticdisallowKeeps dragged annotations inside the page (sets ALLOW_ANNOTS_OUTSIDE_PAGE to false; the default).
StaticenableTurns on hover cursors (sets ENABLE_ANNOTATION_HOVER_CURSORS to true).
StaticenableTurns on automatic text selection by the edit tool (sets ENABLE_AUTO_SWITCH to true).
Selects an annotation as soon as it is pressed, so it can be dragged in the same gesture (text markup is still selected on release).
Allows selecting text with this tool (the default).
Viewport event → the page and page coordinates under the pointer (unrotated page, top-left origin, pt).
Whether text can be selected with this tool.
True when text selection is allowed.
Called when a key is pressed while the viewer has focus; does nothing in the base class.
Fires annotationDoubleClicked; free text enters inline editing.
Called when the left mouse button or a touch goes down on the viewer; does nothing in the base class.
Called when the left mouse button or a touch is released; does nothing in the base class.
Called when the pointer moves over the viewer; does nothing in the base class.
Called when the right mouse button goes down on the viewer; does nothing in the base class.
The pointer event.
Removes every listener of every event.
StaticsetSets the maximum size when resizing annotations.
StaticsetSets the minimum size when resizing annotations (static, shared by all select / edit tools).
Sets the name of the tool.
The tool name.
Changes the tool's default style (used by annotations created afterwards); fires toolUpdated.
const { documentViewer, Annotations, Tools } = instance.Core;
const freeTextTool = documentViewer.getTool(Tools.ToolNames.FREETEXT);
freeTextTool.setStyles({ TextColor: new Annotations.Color(0, 0, 0), FontSize: '14pt', Font: 'Helvetica' });
documentViewer.getTool(Tools.ToolNames.HIGHLIGHT).setStyles({ StrokeColor: new Annotations.Color(0, 255, 0), Opacity: 0.6 });
Switch out: the cursor returns to default.
Called on a tap (a touch press and release without moving); does nothing in the base class.
The pointer event.
The annotation being drawn, not yet added to the document.
StaticAUTO_When on, annotations created from a text selection write the selected text to their content (off by default; one switch shared by subclasses).
The cursor of text tools is text.
Default style of annotations created by the tool (such as StrokeColor, StrokeThickness, Opacity); changed with setStyles.
StaticENABLE_Changes the cursor on hover by what is under the pointer (annotations, handles, text); the stamp, attachment, eraser and marquee zoom tools turn it off, and it is turned back on when they switch out (Tool.ENABLE_ANNOTATION_HOVER_CURSORS).
StaticENABLE_Whether the edit tool selects text automatically when hovering over text (the edit tool selects text itself, so when this is off it neither selects text nor shows the text cursor; the instance enable / disableTextSelection must also be on). Turned off on touch screens.
Name the tool is registered under (one of ToolNames).
Base class for creating text markup: drag on text to select it; the quadrilaterals of the selected lines → TextMarkupAnnotation.Quads (during the drag only synchronous hit tests, see TextSelector); a selection across pages creates one annotation per page. When there is no text under the press (such as scans), it falls back to one quadrilateral from the dragged rectangle. The flow is the same as shapes: press creates (annotationCreated), drag changes the quadrilaterals, release calls addAnnotation (annotationAdded); annotations that are too small are dropped. When the static switch AUTO_SET_TEXT is on (off by default) the selected text is written to the content (Contents), and no longer overwritten once the user changes the content.