onShapeEvents([callback], [remove])
Class: Panel.
Description:
Registers, unregisters and gets a list of handler functions for Shape events (such as when mouse enters, leaves, mouse button clicks, etc.).
Parameters:
| Name | Type | Description |
|---|---|---|
|
|
function |
Event handler function that receives event Object as an argument. Check example below for event Object format. |
|
|
boolean |
Set to |
Returns:
Returns an array of registered handler functions if arguments are omitted, otherwise returns this component instance.
Type: Array.<function()> | ComboBox
Examples:
let handler = function(e){console.log(e);}
mainForm.panel_1 = new Panel().addTo(mainForm).onPopupEvents(handler);
// event Object format:
const e = {
target: object, // The Panel component that triggered the event.
type: string, // Possible values: `click`, `mousedown`, `mouseup`, `mouseenter`, `mouseleave`.
x: number, // X position relative to target.
y: number, // Y position relative to target.
shapeIndex: number, // Index of the shape that triggered the event.
dragging: boolean, // `true` if mouse is down while moving, otherwise false.
alt: boolean, // `true` if Alt key was pressed on keyboard when event was emitted.
shift: boolean, // `true` if Shift key was pressed on keyboard when event was emitted.
ctrl: boolean, // `true` if Control key was pressed on keyboard when event was emitted.
modifiers: string, // Modifiers used when the event was emitted
modifiersText: string // Description of used modifiers
};
