Creates a new MarkerView for the specified target image.
// create an instance of MarkerView and pass the target image reference as a parameter
let markerView = new mjslive.MarkerView(document.getElementById('myimg'));
image object to be overlayed with markers.
The suffix of the CSS class name of the marker container (SVG group) element.
Marker types supported by this instance. You can remove some types to limit the markers displayed.
The list of all markers displayed.
Manage style releated settings via the styles
property.
targetRoot
is used to set an alternative positioning root.
This is useful in cases when your target image is positioned, say, inside a div with position: relative;
// set targetRoot to a specific div instead of document.body
markerView.targetRoot = document.getElementById('myRootElement');
Instance id of this instance
Returns true
when MarkerView is open and false
otherwise.
Adds an event listener for one of the marker.js Live events.
type of the event.
function handling the event.
Adds a plugin to the plugin array.
Closes the MarkerView.
Removes an event listener for one of the marker.js Live events.
type of the event.
function currently handling the event.
Removes a plugin from the plugin array.
Sets the currently selected marker or deselects it if no parameter passed.
marker to select. Deselects current marker if undefined.
Initializes the MarkerView and show the markers.
marker configuration created with marker.js 2.
Generated using TypeDoc
MarkerViews is the main class of marker.js Live. It controls the core behavior of the library.
The simplest marker.js Live usage scenario looks something like this:
// skip this line if you are importing marker.js Live into the global space via the script tag import * as mjslive from 'markerjs-live'; // create an instance of MarkerView and pass the target image reference as a parameter const markerView = new mjslive.MarkerView(target); // call the show() method and pass your annotation configuration (created with marker.js 2) as a parameter markerView.show(markerState);