Members | Methods | Events |
---|---|---|
Constructor
new Button(options)
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
Extends
Members
currentState :OpenSeadragon.ButtonState
The button's current state.
Type:
- Source:
element :Element
The button element.
Type:
- Element
- Source:
fadeDelay :Number
How long to wait before fading.
Type:
- Number
- Source:
fadeLength :Number
How long should it take to fade the button.
Type:
- Number
- Source:
tracker :OpenSeadragon.MouseTracker
Tracks mouse/touch/key events on the button.
Type:
- Source:
Methods
addHandler(eventName, handler, userDataopt, priorityopt) → {Boolean}
Add an event handler for a given event.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
eventName |
String | Name of event to register. | ||
handler |
OpenSeadragon.EventHandler | Function to call when event is triggered. | ||
userData |
Object |
<optional> |
null | Arbitrary object to be passed unchanged to the handler. |
priority |
Number |
<optional> |
0 | Handler priority. By default, all priorities are 0. Higher number = priority. |
- Inherited From:
- Source:
Returns:
- True if the handler was added, false if it was rejected
- Type
- Boolean
addOnceHandler(eventName, handler, userDataopt, timesopt, priorityopt) → {Boolean}
Add an event handler to be triggered only once (or a given number of times)
for a given event. It is not removable with removeHandler().
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
eventName |
String | Name of event to register. | ||
handler |
OpenSeadragon.EventHandler | Function to call when event is triggered. | ||
userData |
Object |
<optional> |
null | Arbitrary object to be passed unchanged to the handler. |
times |
Number |
<optional> |
1 | The number of times to handle the event before removing it. |
priority |
Number |
<optional> |
0 | Handler priority. By default, all priorities are 0. Higher number = priority. |
- Inherited From:
- Source:
Returns:
- True if the handler was added, false if it was rejected
- Type
- Boolean
disable()
- Source:
enable()
- Source:
getHandler(eventName)
Get a function which iterates the list of all handlers registered for a given event, calling the handler for each.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | Name of event to get handlers for. |
- Inherited From:
- Source:
notifyGroupEnter()
Used by a button container element (e.g. a ButtonGroup) to transition the button state
to ButtonState.GROUP.
- Source:
notifyGroupExit()
Used by a button container element (e.g. a ButtonGroup) to transition the button state
to ButtonState.REST.
- Source:
numberOfHandlers(eventName) → {number}
Get the amount of handlers registered for a given event.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | Name of event to inspect. |
- Inherited From:
- Source:
Returns:
amount of events
- Type
- number
raiseEvent(eventName, eventArgs) → {Boolean}
Trigger an event, optionally passing additional information.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | Name of event to register. |
eventArgs |
Object | Event-specific data. |
- Inherited From:
- Source:
Returns:
True if the event was fired, false if it was rejected because of rejectEventHandler(eventName)
- Type
- Boolean
removeAllHandlers(eventName)
Remove all event handlers for a given event type. If no type is given all
event handlers for every event type are removed.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | Name of event for which all handlers are to be removed. |
- Inherited From:
- Source:
removeHandler(eventName, handler)
Remove a specific event handler for a given event.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | Name of event for which the handler is to be removed. |
handler |
OpenSeadragon.EventHandler | Function to be removed. |
- Inherited From:
- Source:
Events
blur
Raised when the Button element loses focus.
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
eventSource |
OpenSeadragon.Button | A reference to the Button which raised the event. | |
originalEvent |
Object | The original DOM event. | |
userData |
Object |
<nullable> |
Arbitrary subscriber-defined object. |
- Source:
click
Raised when a mouse button is pressed and released or touch is initiated and ended in the Button element within the time and distance threshold.
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
eventSource |
OpenSeadragon.Button | A reference to the Button which raised the event. | |
originalEvent |
Object | The original DOM event. | |
userData |
Object |
<nullable> |
Arbitrary subscriber-defined object. |
- Source:
enter
Raised when the cursor enters the Button element.
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
eventSource |
OpenSeadragon.Button | A reference to the Button which raised the event. | |
originalEvent |
Object | The original DOM event. | |
userData |
Object |
<nullable> |
Arbitrary subscriber-defined object. |
- Source:
exit
Raised when the cursor leaves the Button element.
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
eventSource |
OpenSeadragon.Button | A reference to the Button which raised the event. | |
originalEvent |
Object | The original DOM event. | |
userData |
Object |
<nullable> |
Arbitrary subscriber-defined object. |
- Source:
focus
Raised when the Button element receives focus.
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
eventSource |
OpenSeadragon.Button | A reference to the Button which raised the event. | |
originalEvent |
Object | The original DOM event. | |
userData |
Object |
<nullable> |
Arbitrary subscriber-defined object. |
- Source:
press
Raised when a mouse button is pressed or touch occurs in the Button element.
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
eventSource |
OpenSeadragon.Button | A reference to the Button which raised the event. | |
originalEvent |
Object | The original DOM event. | |
userData |
Object |
<nullable> |
Arbitrary subscriber-defined object. |
- Source:
release
Raised when the mouse button is released or touch ends in the Button element.
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
eventSource |
OpenSeadragon.Button | A reference to the Button which raised the event. | |
originalEvent |
Object | The original DOM event. | |
userData |
Object |
<nullable> |
Arbitrary subscriber-defined object. |
- Source: