knowthelist / ftui

FTUI version 3
MIT License
32 stars 21 forks source link

Long Press Event for PopUp #32

Closed FinnDIY closed 9 months ago

FinnDIY commented 2 years ago

For the popup module it would be nice if there is an option to decide between ‚click‘ or ‚long press‘. For example a button opens a popup only by long press and set a stage for short press. A similar solution is made here: https://github.com/john-doherty/long-press-event

knowthelist commented 9 months ago

Long press is already available for all components. The syntax for that is

@hold="<function call>"

Example:

<ftui-button [(value)]="GalerieLicht" fill="none" @hold="long_press.open()">
   <ftui-icon name="lightbulb" size="3" [color]="GalerieLicht | map('on:primary, off:medium')"></ftui-icon>
</ftui-button>

<ftui-popup id="long_press" timeout="0">
   <header>LongPress Popup</header>
   <ftui-label>More settings after Long Press ...</ftui-label>
</ftui-popup>

In this example on a long press event the function open() of the object "long_press" is called. The object "long_press" is defined by: id="long_press" in this case.

knowthelist commented 9 months ago

Solved