PHondogo
05/07/2024, 6:57 AMAlexander Maryanovsky
05/07/2024, 12:26 PMPHondogo
05/08/2024, 6:57 AMinternal fun ViewConfiguration.pointerSlop(pointerType: PointerType): Float {
return when (pointerType) {
PointerType.Mouse -> touchSlop * mouseToTouchSlopRatio
else -> touchSlop
}
}
where mouseToTouchSlopRatio = 0.125.dp / 18.dp
Why is there such need for calculation (why not just use provided touchSlop from Local) and only for mouse pointer type case?
With current logic even small move is treated as drag.
So I need to multiply original touchSlop for 144 in my own Local ViewConfiguration::touchSlop (LocalViewConfiguration provides ...) to "fix" this behavior, but in this case my redefined touchSlop will be much greater in case of non mouse pointer type.Igor Demin
05/14/2024, 11:48 AMmouseToTouchSlopRatio
is implementation details, at was introduced as a shortcut for proper mouse support.
You can rely on it, but be wary of future changes (they are unlikely though).
To properly support redefining, API should be extended. Create an issue for it, if it is important.Igor Demin
05/14/2024, 11:51 AMdrag
if you need a custom behavior.
The current default behavior for mouse was chosen by looking at the native OS behavior - the "usual" drag happens almost instantly in most cases.