-
addEventListener(type, fn [, options])
-
Add a handler to the given event name
Parameters:
| Name |
Type |
Argument |
Description |
type |
string
|
number
|
|
The name of the event to listen to |
fn |
function
|
|
The handler to be called when the event is triggered |
options |
object
|
<optional>
|
Optional options object for addEventListener
Properties
| Name |
Type |
Description |
once |
boolean
|
If true then the handler will be called only once |
|
- Inherited From:
-
Returns:
Returns the object that 'addEventListener' is being called on
-
Type
-
object
Example
myObject.addEventListener('eventName', (eventParameter1, eventParameter2) => {
...
});
-
createAndApplyScale(options)
-
Create new scale and apply to the given measurement tools and annotations
Parameters:
-
deleteScale(scale)
-
Deletes a scale and removes or reassigns associated measurement items
Parameters:
| Name |
Type |
Description |
scale |
Core.Scale
|
The scale object that should be deleted |
-
-
Disable the automatic updating of annotation styles even if the corresponding measurement tool's styles are updated
Example
WebViewer(...)
.then(function(instance) {
let measurementManager = instance.Core.documentViewer.getMeasurementManager();
measurementManager.disableAnnotationAndToolStyleSyncing()
});
-
-
Enable annotation's styles to be updated when the corresponding measurement tool's styles are updated
Example
WebViewer(...)
.then(function(instance) {
let measurementManager = instance.Core.documentViewer.getMeasurementManager();
measurementManager.enableAnnotationAndToolStyleSyncing()
});
-
getOldScalesToDeleteAfterApplying(options)
-
Get the old scales that will be deleted after applying the new scale. Note that this will not actually apply the scale
Parameters:
Returns:
Array of scale strings that will be deleted
-
Type
-
Array.<string>
-
getScalePrecision(scale)
-
Gets the precision value for a given scale
Parameters:
| Name |
Type |
Description |
scale |
Core.Scale
|
The scale object to get the precision for |
Returns:
The precision value for the scale
-
Type
-
number
-
getScales()
-
Gets all scales with their associated measurement annotations and tools
Returns:
An object with scale strings as keys and arrays of annotations and tools as values
-
Type
-
Core.MeasurementManager.ScalesObject
-
-
Return true if automatic updating of annotation styles when corresponding measurement tool's styles are updated, otherwise return false
Returns:
True if style syncing is enabled, false otherwise
-
Type
-
boolean
Example
WebViewer(...)
.then(function(instance) {
let measurementManager = instance.Core.documentViewer.getMeasurementManager();
measurementManager.isAnnotationAndToolStyleSyncingEnabled()
});
-
removeEventListener( [type] [, fn])
-
Remove a handler of the given event name and namespace (if given) or with a function reference
Parameters:
| Name |
Type |
Argument |
Description |
type |
string
|
number
|
<optional>
|
The name of the event to remove the handler of with an optional namespace. |
fn |
function
|
<optional>
|
The handler associated with this event to be removed.
If fn is undefined, all the handlers of the given event namespace will be removed.
If you are not passing in this parameter then a namespace must be used with the event name. |
- Inherited From:
-
Returns:
Returns the object that 'removeEventListener' is being called on
-
Type
-
object
Example
myObject.removeEventListener('eventName.namespace');
myObject.removeEventListener('eventName', fn);
-
replaceScale(oldScale, newScale)
-
For all annotations and tools that currently use the old scale, this scale will be replaced with the new scale
Parameters:
| Name |
Type |
Description |
oldScale |
Core.Scale
|
The old scale which is selected |
newScale |
Core.Scale
|
The new scale used to replace the old scale |
Returns:
A scales object with annotations and measurement tools organized by scale
-
Type
-
Core.MeasurementManager.ScalesObject
-
replaceScales(oldScales, newScale)
-
For all annotations and tools that currently use the old scales, these scales will be replaced with the new scale
Parameters:
| Name |
Type |
Description |
oldScales |
Array.<Core.Scale>
|
The array of old scales which are selected |
newScale |
Core.Scale
|
The new scale used to replace the old scales |
Returns:
A scales object with annotations and measurement tools organized by scale
-
Type
-
Core.MeasurementManager.ScalesObject
-
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
myObject.trigger('eventName');
myObject.trigger('eventName', [eventParameter1, eventParameter2]);
-
triggerAsync(type [, data])
-
Calls the handlers of the event name with given data *asynchronously*.
It's different from Core.EventHandler#trigger in that it can be awaited to ensure all async handlers have finished executing code
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 'triggerAsync' is being called on
-
Type
-
Promise.<Object>
Example
myObject.triggerAsync('eventName');
myObject.triggerAsync('eventName', [eventParameter1, eventParameter2]);