Type class
Interaction manages all aspects of user interaction - mouse move, click, hover, drag events, touch gestures.
InteractionObject
elements that want to use certain events, must attach event listeners to Interaction instance.
Interaction itself will not modify InteractionObject
elements, it will be up to those elements to handle interaction information received via event triggers.
IInteractionEvents
for a list of available events
Sources
Interaction can be used (imported) via one of the following packages.
/** * -------------------------------------------------------- * Import from: "core.ts" * Use like: am4core.Interaction * -------------------------------------------------------- */ import * as am4core from "@amcharts/amcharts4/core";
/** * -------------------------------------------------------- * Include via: <script src="core.js"></script> * Access items like: am4.Interaction * -------------------------------------------------------- */
Inheritance
Interaction extends BaseObjectEvents
.
Interaction is not extended by any other symbol.
Properties
body # |
Type A reference to an Users can use it to add global, non-chart related events, that will be applicable to the whole document. |
---|---|
clonedFrom # |
Type Inherited from Reference to the original object this object was cloned from. We need to keep this so we can disassociate it from source object when this object is disposed. |
config # |
Type Inherited from Use this property to set JSON-based config. When set, triggers processing routine, which will go through all properties, and try to apply values, create instances, etc. Use this with caution, as it is a time-consuming process. It's used for initialchart setup only, not routine operations. |
downObjects # |
Type Default List of objects that currently has a pressed pointer. |
events # |
Type Inherited from An |
focusedObject # |
Type An object that currently has focus. Usually set automatically via |
id # |
Type Inherited from Sets the user-defined id of the element. |
inertiaOptions # |
Type Default Inertia options that need to be applied to after element drag, if it's This is just a default, which can and probably will be overridden by actual elements. |
overObjects # |
Type Default List of objects that current have a pointer hovered over them. |
passiveSupported # |
Static
Type Indicates if passive mode options is supported by this browser. |
pointers # |
Type Default Holds all known pointers. |
trackedObjects # |
Type Default List of objects that need mouse position to be reported to them. |
transformedObjects # |
Type Default List of objects that are currently being dragged. |
uid # |
Type Inherited from Returns object's internal unique ID. |
There are 5 inherited items currently hidden from this list. |
Methods
areTransformed( except?: ) |
Returns Checks whether there are currently any objects being transformed (dragged or resized). If @since 4.9.3 |
---|---|
clone( cloneId?: ) |
Returns Inherited from Makes a copy of this object and returns the clone. Try to avoid cloning complex objects like chart, create new instances if you need them. |
constructor() |
Returns Constructor. Sets up universal document-wide move events to handle stuff outside particular chart container. |
copyFrom( source: ) |
Returns Inherited from Copies all parameters from another |
dispatch( eventType: ) |
Returns Inherited from Dispatches an event using own event dispatcher. Will automatically populate event data object with event type and target (this element). It also checks if there are any handlers registered for this sepecific event. |
dispatchImmediately( eventType: ) |
Returns Inherited from Works like |
dispose() |
Returns Disposes this object and cleans up after itself. |
dragStart( io: ) |
Returns Manually triggers drag start on the element. Could be useful in cases where tracking or dragging one element can also influence dragging another element. Passing in |
dragStop( io: ) |
Returns Manually ends drag on the element. |
getCurrentThemes() |
Returns Inherited from Returns a list of themes that should be applied to this element. It could either be a list of themes set explicitly on this element, or system-wide. |
getDragPointer( io?: ) |
Returns This method uses a fuzzy logic to find the pointer to be used for dragging. Beware that this is not a rock-solid solution. If there are a few objects being dragged at the same time, you may get unexepected results. |
getInteraction( element: ) |
Returns Returns an You can use this on any HTML or SVG element, to add interactive features to it. |
getShift( pointer: ) |
Returns Returns total a shift in pointers coordinates between its original position and now. |
getTrailPoint( pointer: ) |
Returns Returns a point from |
isDisposed() |
Returns Inherited from Returns if this object has been already been disposed. |
moved( pointer: ) |
Returns Checks if pointer has moved since it was created. |
restoreAllStyles( ) |
Returns Restore temporarily reset styles on an element. |
restoreStyle( io: ) |
Returns Restores specific style on an element. |
setTemporaryStyle( io: ) |
Returns Sets a style property on an element. Stores original value to be restored later with
|
swiped( io: ) |
Returns Returns |
swiping( io: ) |
Returns Check if swiping is currently being performed on an object. |
There are 6 inherited items currently hidden from this list. |
Events
#down |
Param { event: |
---|---|
#focus |
Param { event: |
#track |
Param { event: |
#up |
Param { event: |
Adapters
Interaction does not have any adapters.