Class: WidgetEditingManager

CoreControls. WidgetEditingManager

A manager class that controls widget editing.

new WidgetEditingManager()

Extends

Methods


endEditing()

Exit the widgets editing mode

getEditableAnnotation(widget)

Gets the associated annotation of the widget annotation The associated annotation is a resizable/moveable annotation that appears during the editing mode
Parameters:
Name Type Description
widget Annotations.Annotation a widget annotation
Returns:
the associated rectangle if it exists
Type
Annotations.Annotation | null

getEditableAnnotationStyles()

Gets the styles of editable annotations
Returns:
Returns the styles
Type
CoreControls.WidgetEditingManager.EditableAnnotationStyles

getWidget(annotation)

Gets the associated widget of the associated annotation
Parameters:
Name Type Description
annotation Annotations.Annotation an annotation that appears in the editing mode
Returns:
the associated widget if it exists
Type
Annotations.Annotation | null

isEditableAnnotation(annotation)

Gets if the annotation is an editable annotation that appears during the editing mode
Parameters:
Name Type Description
annotation Annotations.Annotation an annotation object
Returns:
true if it's an editable annotation
Type
boolean

isEditing()

Gets if the widget editing manager is currently in the widgets editing mode

off( [type] [, fn])

Remove a handler of the given event name
Parameters:
Name Type Argument Description
type string | number <optional>
The name of the event to remove the handler of. If type is undefined, all the handlers of the object will be removed
fn function <optional>
The handler associated with this event to be removed. If fn is undefined, all the handlers of the given event name will be removed
Inherited From:
Returns:
Returns the object that 'off' is being called on
Type
object
Example
annotManager.off();
annotManager.off('annotationChanged');
annotManager.off('annotationChanged', fn);

on(type, fn)

Add a handler to the given event name
Parameters:
Name Type Description
type string | number The name of the event to listen to
fn function The handler to be called when the event is triggered
Inherited From:
Returns:
Returns the object that 'on' is being called on
Type
object
Example
annotManager.on('annotationChanged', (annotations, action) => {
  ...
});

one(type, fn)

Same as 'on' except the handler will be called only once
Parameters:
Name Type Description
type string | number The name of the event to listen to
fn function The handler to be called when the event is triggered
Inherited From:
Returns:
Returns the object that 'one' is being called on
Type
object
Example
annotManager.one('annotationChanged', (annotations, action) => {
 ...
});

setEditableAnnotationStyles(styles)

Sets the styles that will be used to create editable annotations in the widget editing mode
Parameters:
Name Type Description
styles CoreControls.WidgetEditingManager.EditableAnnotationStyles The styles that will be used for editable annotations

startEditing()

Enter the widgets editing mode

trigger(type [, data])

Calls the handlers of the event name with given data
Parameters:
Name Type Argument Description
type string | number event name of which the handlers will be called.
data * <optional>
data that will be passed to the handlers. If data is an array, it will be spread and then passed to the handlers
Inherited From:
Returns:
Returns the object that 'trigger' is being called on
Type
object
Example
annotManager.trigger('annotationChanged');
annotManager.trigger('annotationChanged', [[annotation], 'add', {}]);

Type Definitions


EditableAnnotationStyles

Type:
  • Object
Properties:
Name Type Argument Description
FillColor Annotations.Color <optional>
The fill color of the annotation
StrokeColor Annotations.Color <optional>
The stroke color of the annotation
StrokeThickness number <optional>
The border thickness of the annotation
Opacity number <optional>
the opacity of the annotation

Events


editingEnded

Triggered after WebViewer exists the widget editing mode

editingStarted

Triggered after WebViewer enters the widget editing mode