Adds the element with the given id, with the given values for x, y, width, height and rotation. Any of these may be null.
Bind an event listener. This method can be used with a type parameter by call sites; although it's not necessary it can be helpful to use this to ensure you've thought about what the payload to your event handler is going to be.
Name of the event(s) to bind to.
Function to bind to the given event(s)
Optional
e: anyOptional
insertAtStart: booleanWhether or not to insert this listener at the head of the listener queue. Defaults to false.
Gets the position of the element. This returns both the original position, and also the translated position of the element. Certain internal methods, such as the anchor calculation code, use the unrotated position and then subsequently apply the element's rotation to any calculated positions. Other parts of the codebase - the Toolkit's magnetizer or pan/zoom widget, for instance - are interested in the rotated position.
Update the size/offset of the element with the given id, and adjust viewport bounds.
Optional
doNotRecalculateBounds: booleanIf true, the viewport's bounds won't be recalculated after the element's size and position has been refreshed.
Creates an empty entry for an element with the given ID.
Optional
doNotRecalculateBounds: booleanIf true, the viewport's bounds won't be recalculated after the element has been registered.
Unbind the given event listener, or all listeners. If you call this method with no arguments then all event listeners are unbound.
Optional
eventOrListener: string | FunctionEither an event name, or an event handler function
Optional
listener: FunctionIf eventOrListener
is defined, this is the event handler to unbind.
Updates the element with the given id. Any of the provided values may be null, in which case they are ignored (we never overwrite an existing value with null).
Optional
doNotRecalculateBounds: booleanDefaults to false. For internal use. If true, does not update viewport bounds after updating the element.
Models the positions of the elements a given jsPlumb instance is tracking. Users of the API should not need to interact directly with a Viewport.