Skip to main content

Interface: ImgTouchButtonProps

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:7

Component props for ImgTouchButton.

Extends

Properties

children?

optional children: DisplayChildren[]

Defined in: src/sdk/components/FSComponent.ts:122

The children of the display component.

Inherited from

TouchButtonProps.children


class?

optional class: string | SubscribableSet<string>

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:168

CSS class(es) to apply to the button's root element.

Inherited from

TouchButtonProps.class


dragThresholdPx?

optional dragThresholdPx: number

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:156

The distance, in pixels, the mouse can click and drag before the pad begins to ignore mouse events. Ignored if inhibitOnDrag is false. Defaults to 40 pixels.

Inherited from

TouchButtonProps.dragThresholdPx


focusOnDrag?

optional focusOnDrag: boolean

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:143

Whether the button should focus all mouse events when dragging and the button is primed or held, preventing the events from bubbling up to any ancestors in the DOM tree. Defaults to false.

Inherited from

TouchButtonProps.focusOnDrag


imgSrc?

optional imgSrc: string | Subscribable<string>

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:9

The src of the button's image. If not defined, the button will not display an image.


inhibitOnDrag?

optional inhibitOnDrag: boolean

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:150

Whether the button should stop responding to mouse events and instead forward them to its parent after clicking and dragging for a certain distance defined by dragThresholdPx along the axis defined by inhibitOnDragAxis. When mouse events are inhibited, the button cannot be primed or held. Defaults to false.

Inherited from

TouchButtonProps.inhibitOnDrag


inhibitOnDragAxis?

optional inhibitOnDragAxis: "both" | "x" | "y"

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:162

The axis along which dragging will trigger the inhibit function. Ignored if inhibitOnDrag is false. Defaults to 'both'.

Inherited from

TouchButtonProps.inhibitOnDragAxis


isEnabled?

optional isEnabled: boolean | Subscribable<boolean>

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:79

Whether the button is enabled, or a subscribable which provides it. Disabled buttons cannot be touched, primed, pressed, or held. Defaults to true.

Inherited from

TouchButtonProps.isEnabled


isHighlighted?

optional isHighlighted: boolean | Subscribable<boolean>

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:82

Whether the button is highlighted, or a subscribable which provides it. Defaults to false.

Inherited from

TouchButtonProps.isHighlighted


isVisible?

optional isVisible: boolean | Subscribable<boolean>

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:85

Whether the button is visible. Defaults to true.

Inherited from

TouchButtonProps.isVisible


label?

optional label: string | VNode | Subscribable<string>

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:94

The label for the button. Can be defined as either a static string, a subscribable which provides the label string, or a VNode. If not defined, the button will not have a label.

If the label is defined as a VNode, all first-level DisplayComponents in the VNode tree will be destroyed when the button is destroyed.

Inherited from

TouchButtonProps.label


onDestroy()?

optional onDestroy: () => void

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:165

A callback function which will be called when the button is destroyed.

Returns

void

Inherited from

TouchButtonProps.onDestroy


onHoldEnded()?

optional onHoldEnded: <B>(button, totalHoldDuration, endReason) => void

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:137

A function which is called when the button exits the held state.

Type Parameters

Type ParameterDefault type
B extends TouchButton<TouchButtonProps>TouchButton<TouchButtonProps>

Parameters

ParameterTypeDescription
buttonBThe button that was held.
totalHoldDurationnumberThe total amount of time, in milliseconds, that the button was held.
endReasonTouchButtonHoldEndReasonThe reason that the button exited the held state.

Returns

void

Inherited from

TouchButtonProps.onHoldEnded


onHoldStarted()?

optional onHoldStarted: <B>(button) => TouchButtonHoldAction

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:117

A function which is called when the button enters the held state. If not defined, then the button will default to taking no specific action when it enters the held state.

Type Parameters

Type ParameterDefault type
B extends TouchButton<TouchButtonProps>TouchButton<TouchButtonProps>

Parameters

ParameterTypeDescription
buttonBThe button that is held.

Returns

TouchButtonHoldAction

The action to take. Ignored if the value is equal to TouchButtonHoldAction.EndHold.

Inherited from

TouchButtonProps.onHoldStarted


onHoldTick()?

optional onHoldTick: <B>(button, dt, totalTime, timeSinceLastPress) => TouchButtonHoldAction

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:129

A function which is called every frame when the button is held. If not defined, then the button will default to taking no specific action with each frame tick.

Type Parameters

Type ParameterDefault type
B extends TouchButton<TouchButtonProps>TouchButton<TouchButtonProps>

Parameters

ParameterTypeDescription
buttonBThe button that is held.
dtnumberThe elapsed time, in milliseconds, since the previous frame.
totalTimenumberThe total amount of time, in milliseconds, that the button has been held.
timeSinceLastPressnumberThe amount of time, in milliseconds, that the button has been held since the last time the button was pressed as a tick action.

Returns

TouchButtonHoldAction

The action to take.

Inherited from

TouchButtonProps.onHoldTick


onPressed()?

optional onPressed: <B>(button, isHeld) => void

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:109

A callback function which will be called every time the button is pressed.

Type Parameters

Type ParameterDefault type
B extends TouchButton<TouchButtonProps>TouchButton<TouchButtonProps>

Parameters

ParameterTypeDescription
buttonBThe button that was pressed.
isHeldbooleanWhether the button was held when it was pressed.

Returns

void

Inherited from

TouchButtonProps.onPressed


onTouched()?

optional onTouched: <B>(button) => TouchButtonOnTouchedAction

Defined in: src/garminsdk/components/touchbutton/TouchButton.tsx:102

A callback function which will be called every time the button is touched (i.e. a mouse down event on the button is detected). If not defined, then the button will default to entering the primed state when touched.

Type Parameters

Type ParameterDefault type
B extends TouchButton<TouchButtonProps>TouchButton<TouchButtonProps>

Parameters

ParameterTypeDescription
buttonBThe button that was touched.

Returns

TouchButtonOnTouchedAction

The action to take as a result of the button being touched.

Inherited from

TouchButtonProps.onTouched


ref?

optional ref: NodeReference<any>

Defined in: src/sdk/components/FSComponent.ts:125

A reference to the display component.

Inherited from

TouchButtonProps.ref