Class: BgImgTouchButton
Defined in: garminsdk/components/touchbutton/BgImgTouchButton.tsx:24
A touchscreen button which uses different images for its "up" state and "down" state backgrounds and displays an optional label.
The root element of the button contains the bg-img-touch-button CSS class by default, in addition to all
root-element classes used by TouchButton, with the exception of touch-button itself.
The root element contains optional child <img> elements with the CSS classes bg-img-touch-button-up-img and
bg-img-touch-button-down-img as well as an optional label element with the CSS class bg-img-touch-button-label.
Extends
Constructors
Constructor
new BgImgTouchButton(
props):BgImgTouchButton
Defined in: sdk/components/FSComponent.ts:73
Creates an instance of a DisplayComponent.
Parameters
| Parameter | Type | Description |
|---|---|---|
props | BgImgTouchButtonProps | The propertis of the component. |
Returns
BgImgTouchButton
Inherited from
Properties
context?
optionalcontext: [] =undefined
Defined in: sdk/components/FSComponent.ts:64
The context on this component, if any.
Inherited from
contextType?
readonlyoptionalcontextType: readonly [] =undefined
Defined in: sdk/components/FSComponent.ts:67
The type of context for this component, if any.
Inherited from
cssClassSet
protectedreadonlycssClassSet:SetSubject<string>
Defined in: garminsdk/components/touchbutton/BgImgTouchButton.tsx:34
Overrides
cssClassSub?
protectedoptionalcssClassSub:Subscription
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:241
Inherited from
currentMousePosition
protectedreadonlycurrentMousePosition:Vec2
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:244
Inherited from
TouchButton.currentMousePosition
downImgSrc
protectedreadonlydownImgSrc:undefined|MappedSubscribable<string>
Defined in: garminsdk/components/touchbutton/BgImgTouchButton.tsx:39
dragThresholdPxActual
protectedreadonlydragThresholdPxActual:number
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:248
Inherited from
TouchButton.dragThresholdPxActual
focusOnDrag
protectedreadonlyfocusOnDrag:boolean
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:246
Inherited from
holdTickInterval
protectedholdTickInterval:null|Timeout=null
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:210
Inherited from
holdTimeSinceLastPress
protectedholdTimeSinceLastPress:number=0
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:213
Inherited from
TouchButton.holdTimeSinceLastPress
inhibitOnDrag
protectedreadonlyinhibitOnDrag:boolean
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:247
Inherited from
inhibitOnDragAxisActual
protectedreadonlyinhibitOnDragAxisActual:"both"|"x"|"y"
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:249
Inherited from
TouchButton.inhibitOnDragAxisActual
isEnabled
protectedreadonlyisEnabled:Subscribable<boolean> |Subscribable<false> |Subscribable<true>
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:199
Inherited from
isEnabledSub?
protectedoptionalisEnabledSub:Subscription
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:238
Inherited from
isHeld
protectedisHeld:boolean=false
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:208
Inherited from
isHighlighted
protectedreadonlyisHighlighted:Subscribable<boolean> |Subscribable<false> |Subscribable<true>
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:200
Inherited from
isHighlightedSub?
protectedoptionalisHighlightedSub:Subscription
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:239
Inherited from
isPrimed
protectedisPrimed:boolean=false
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:207
Inherited from
isVisible
protectedreadonlyisVisible:Subscribable<boolean> |Subscribable<false> |Subscribable<true>
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:201
Inherited from
isVisibleSub?
protectedoptionalisVisibleSub:Subscription
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:240
Inherited from
labelContent
protectedreadonlylabelContent:undefined|string|VNode|MappedSubscribable<string>
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:203
Inherited from
lastHoldTickTime
protectedlastHoldTickTime:undefined|number=undefined
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:211
Inherited from
mouseClickPosition
protectedreadonlymouseClickPosition:Vec2
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:243
Inherited from
TouchButton.mouseClickPosition
mouseDownListener()
protectedreadonlymouseDownListener: (e) =>void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:194
Responds to mouse down events on this button's root element.
Parameters
| Parameter | Type | Description |
|---|---|---|
e | MouseEvent | The mouse event. |
Returns
void
Inherited from
mouseLeaveListener()
protectedreadonlymouseLeaveListener: (e) =>void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:196
Responds to mouse leave events on this button's root element.
Parameters
| Parameter | Type | Description |
|---|---|---|
e | MouseEvent | The mouse event. |
Returns
void
Inherited from
TouchButton.mouseLeaveListener
mouseMoveListener()
protectedreadonlymouseMoveListener: (e) =>void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:197
Handle mouse moving after clicking.
Parameters
| Parameter | Type | Description |
|---|---|---|
e | MouseEvent | The mouse event. |
Returns
void
Inherited from
mouseUpListener()
protectedreadonlymouseUpListener: () =>void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:195
Responds to mouse up events on this button's root element.
Returns
void
Inherited from
props
props:
BgImgTouchButtonProps&ComponentProps
Defined in: sdk/components/FSComponent.ts:61
The properties of the component.
Inherited from
rootRef
protectedreadonlyrootRef:NodeReference<HTMLDivElement>
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:190
Inherited from
totalHoldTime
protectedtotalHoldTime:number=0
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:212
Inherited from
upImgSrc
protectedreadonlyupImgSrc:undefined|MappedSubscribable<string>
Defined in: garminsdk/components/touchbutton/BgImgTouchButton.tsx:36
RESERVED_CSS_CLASSES
protectedreadonlystaticRESERVED_CSS_CLASSES:Set<string>
Defined in: garminsdk/components/touchbutton/BgImgTouchButton.tsx:25
Overrides
TouchButton.RESERVED_CSS_CLASSES
Methods
destroy()
destroy():
void
Defined in: garminsdk/components/touchbutton/BgImgTouchButton.tsx:68
Destroys this component.
Returns
void
Overrides
getContext()
protectedgetContext(context):never
Defined in: sdk/components/FSComponent.ts:106
Gets a context data subscription from the context collection.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | never | The context to get the subscription for. |
Returns
never
The requested context.
Throws
An error if no data for the specified context type could be found.
Inherited from
getDragDistance()
protectedgetDragDistance():number
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:487
Get the distance that the mouse has been dragged on the correct axis.
Returns
number
The distance.
Inherited from
getReservedCssClasses()
protectedgetReservedCssClasses():ReadonlySet<string>
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:540
Gets the CSS classes that are reserved for this button's root element.
Returns
ReadonlySet<string>
The CSS classes that are reserved for this button's root element.
Inherited from
TouchButton.getReservedCssClasses
getRootElement()
getRootElement():
HTMLElement
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:293
Gets this button's root HTML element.
Returns
HTMLElement
This button's root HTML element.
Throws
Error if this button has not yet been rendered.
Inherited from
holdTickFunc()
protectedreadonlyholdTickFunc():void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:215
Returns
void
Inherited from
onAfterRender()
onAfterRender(
node):void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:253
A callback that is called after the component is rendered.
Parameters
| Parameter | Type | Description |
|---|---|---|
node | VNode | The component's VNode. |
Returns
void
Inherited from
onBeforeRender()
onBeforeRender():
void
Defined in: sdk/components/FSComponent.ts:80
A callback that is called before the component is rendered.
Returns
void
Inherited from
onMouseDown()
protectedonMouseDown(e):void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:390
Responds to mouse down events on this button's root element.
Parameters
| Parameter | Type | Description |
|---|---|---|
e | MouseEvent | The mouse event. |
Returns
void
Inherited from
onMouseLeave()
protectedonMouseLeave(e):void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:439
Responds to mouse leave events on this button's root element.
Parameters
| Parameter | Type | Description |
|---|---|---|
e | MouseEvent | The mouse event. |
Returns
void
Inherited from
onMouseMove()
protectedonMouseMove(e):void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:460
Handle mouse moving after clicking.
Parameters
| Parameter | Type | Description |
|---|---|---|
e | MouseEvent | The mouse event. |
Returns
void
Inherited from
onMouseUp()
protectedonMouseUp():void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:426
Responds to mouse up events on this button's root element.
Returns
void
Inherited from
onPressed()
protectedonPressed():void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:498
Responds to when this button is pressed.
Returns
void
Inherited from
render()
render():
VNode
Defined in: garminsdk/components/touchbutton/BgImgTouchButton.tsx:43
Renders the component.
Returns
A JSX element to be rendered.
Overrides
renderLabel()
protectedrenderLabel():null|VNode
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:526
Renders this button's label.
Returns
null | VNode
This button's rendered label, or null if this button does not have a label.
Inherited from
setHeld()
protectedsetHeld(isHeld,endReason):void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:342
Sets the held state of this button.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
isHeld | boolean | undefined | The new held state. |
endReason | TouchButtonHoldEndReason | TouchButtonHoldEndReason.Unknown | The reason that the held state is set to false. Ignored if isHeld is true. Defaults to TouchButtonHoldEndReason.Unknown. |
Returns
void
Inherited from
setPrimed()
protectedsetPrimed(isPrimed):void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:312
Sets the primed state of this button.
Parameters
| Parameter | Type | Description |
|---|---|---|
isPrimed | boolean | The new primed state. |
Returns
void
Inherited from
simulatePressed()
simulatePressed(
ignoreDisabled):void
Defined in: garminsdk/components/touchbutton/TouchButton.tsx:302
Simulates this button being pressed. This will execute the onPressed() callback if one is defined.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
ignoreDisabled | boolean | false | Whether to simulate the button being pressed regardless of whether the button is disabled. Defaults to false. |
Returns
void