nfdi4plants / Swate

Excel Add-In for annotation of experimental data and computational workflows.
https://swate-alpha.nfdi4plants.org
MIT License
30 stars 6 forks source link

[Feature Request] SWATE: Make modal-cards created using the buttons "Add Building Block" and "Add template" drag-able using touch devices #385

Open ZimmerD opened 4 months ago

ZimmerD commented 4 months ago

Is your feature request related to a problem? Please describe. I am currently experimenting using the ARCitect on a Windows 11 Laptop with a touchscreen and I noticed that the cards opened using the buttons "Add Building Block" and "Add template" are not yet movable using touch gestures.

Describe the solution you'd like Being able to move the cards using touch gestures

Describe alternatives you've considered Using a mouse or a pen or expanding the SWATE view

Freymaurer commented 4 months ago

I started investigating this issue but it is no trivial task. Will have to resolve some higher priority issues first.

Here is a reminder for future me:

prop.onTouchStart (fun e ->
    let startPosition = {X = int e.touches.[0].clientX; Y = int e.touches.[0].clientY}
    let startSize = {X = int element.current.Value.offsetWidth; Y = int element.current.Value.offsetHeight}
    let onmousemove = ResizeEventListener.onmousemove startPosition startSize setSize
    let onmouseup = fun e -> ResizeEventListener.onmouseup (prefix, element) onmousemove
    Browser.Dom.document.addEventListener("touchmove", onmousemove)
    let config = createEmpty<AddEventListenerOptions>
    config.once <- true
    Browser.Dom.document.addEventListener("touchup", onmouseup, config)
)