- assertType
- assertObjectType
- isHTMLElement
- filterDefault
- test
- Events
- Exception
- imagemarker
- ImageMarker
- Background
- defaultStageControl
- Drawn
- Opened
- Stage
- HandlerResult
- UserCtl
Assert given type is the expected one
-
givenGiven type -
expectedExpected type -
Throws UnexpectedTypeException When the assertion is false
Assert given object is the expected type
-
givenObject Given type -
expectedObject Expected type -
Throws UnexpectedTypeException When the assertion is false
Test whether or not given object is a HTML element
elObject Element
Returns boolean Whether or not it's a HTML element
Merge the given value with the default value
-
defObject Default value -
valObject Given value -
Throws UnexpectedTypeException When the data type in default value failed to match the one inside of the given one.
Returns Object Merged object
Perform the compatibility test
- Throws IncompatibleContextException When current running context is incompatibiable with ImageMarker
Event manager
Insert new event listener into a type
typestring Type of the target eventlistenerfunction The listener that will be called when event fired
Remove the given event listener from a type
typestring Type of the target eventlistenerfunction The listener which was going to be called when event fired
Fire a event
typestring Event typedataEvent data
Remove all event listeners
Base Exception
messagestring The error message
Return the error message into a string
Returns string The error message
Creating a new ImageMarker instance
driverObject stage driver
import imageMarker from '~ImageMarker/imagemarker.js'
let marker = imageMarker(driver)Returns ImageMarker a new Image Marker instance
The main class, manages the status (from creation to destroy) of the ImageMarker
stageDriverObject Instance of the stage driver
Tears down current instance, unrecoverablely
Clear current stage without destroying it
Open a new stage
backgroundBackground Background objectwaitLoadboolean Whether or not to wait until the background is loadedcontrolBuilderObject Builder of user controls
Returns Promise<Opened> An opened stage
Re-adjecting current stage
Insert new event listener to an internal event
Remove a listener from listening an internal event
Background object
urlstring URL address of the background imagewidthnumber Width of the image in pxheightnumber Height of the image in px
Return the URL
Returns string
Return the width of the background image
Returns number
Return the height of the background image
Returns number
Return the ratio of the background image
Returns number
Return the zoom level according to the given target width and height
Returns number The zoom level
Return whether or not given target width and height can be zoomed to
Returns boolean Whether or not zoomable
Creating a default user controls of the stage
Returns Object User controls
Drawn element on the stage
drawnObject Drawn object
Return the raw element of current drawn object
Returns Object
Remove current element from the stage
Set the properties of current drawn object. Actual effect depends on the stage driver
propertiesObject New properties
Return the dimension of current drawn object
Returns Object
Export the data of current drawn object
Returns Object
Represents an opened stage
Reset current opened stage to it's initial configuation
Zoom the stage
screenCenterXnumber X coordinate of the center view pointscreenCenterYnumber Y coordinate of the center view pointpanXOffsetnumber X pan offsetpanYOffsetnumber Y pan offsetzoomShiftnumber Zoom offset
Insert a drawing
Returns Drawn Drawn object
Compose a drawing
-
propertiesObject Properties -
drawingControlObject User drawning control -
composeTypestring Drawing type -
Throws StageAlreadyComposing When the stage already at composing status
Returns Promise<Drawn> Drawn object
Close current stage
Stage control
Return current stage element
Returns Object
Open a new stage
-
backgroundBackground Stage background -
onSuccessfunction Successful callback -
onFailfunction Failure callback -
controlsObject User controls -
waitLoadboolean Whether or not to wait until the background is loaded -
Throws StageAlreadyOpened When the stage already been opened
Clear current stage
Destroy current stage
Re-adjust current stage
Handler result
contextcontinueNext
User control manager
rootElementObject The root element which the control handler will be binded toeventsEvents Event manager
Listen to the given UI control listener set
listenersObject Listeners setdataObject Context data which will be delievered to control listeners when control event is fired
Remove UI control listener set
listenersObject Listeners set
Destroy current user control manager