Ignore drag-releases in slider double-click reset; tune HUD slider defaults
A pointer-up after a drag no longer counts as a click (dragging flag + press-to-release distance within the existing tolerance), so drag -> release -> click cannot trigger a reset anymore. PaintHud prefab: pointer tolerance 4 px, HalfLambert default back to 0.5. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
07839d0a7e
commit
14015d7134
2 files changed
+7
-2
No files matched your search
@@ -12470,7 +12470,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: d3e16aacd913a5149ab3ccf77d93cd5c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::SliderDoubleClickReset
|
||||
_defaultValue: 0.1
|
||||
_defaultValue: 0.5
|
||||
_maxClickInterval: 0.25
|
||||
_maxPointerDistance: 4
|
||||
--- !u!1001 &1796302450561085447
|
||||
|
||||
@@ -27,7 +27,12 @@ public class SliderDoubleClickReset : MonoBehaviour, IPointerClickHandler
|
||||
{
|
||||
if (eventData.button != PointerEventData.InputButton.Left) return;
|
||||
|
||||
// Unitys clickCount (festes ~0.3s-Fenster, kein Positions-Check) bewusst ignoriert.
|
||||
if (eventData.dragging || (eventData.position - eventData.pressPosition).sqrMagnitude > _maxPointerDistance * _maxPointerDistance)
|
||||
{
|
||||
_lastClickTime = float.NegativeInfinity;
|
||||
return;
|
||||
}
|
||||
|
||||
bool isDouble = Time.unscaledTime - _lastClickTime <= _maxClickInterval
|
||||
&& (eventData.position - _lastClickPosition).sqrMagnitude <= _maxPointerDistance * _maxPointerDistance;
|
||||
|
||||
|
||||
Reference in new issue
Block a user