/// <summary>Gets the pinch ratio of the fingers (reciprocal of pinch scale).</summary> public static bool TryGetPinchRatio(List <LeanFinger> fingers, Vector2 center, Vector2 lastCenter, ref float ratio, float wheelSensitivity = 0.0f) { var distance = GetScreenDistance(fingers, center); var lastDistance = GetLastScreenDistance(fingers, lastCenter); if (distance > 0.0f) { ratio = lastDistance / distance; return(true); } if (wheelSensitivity != 0.0f) { var scroll = LeanInput.GetMouseWheelDelta(); if (scroll > 0.0f) { ratio = 1.0f + wheelSensitivity; return(true); } if (scroll < 0.0f) { ratio = 1.0f - wheelSensitivity; return(true); } } return(false); }
protected virtual void Update() { if (RequiredSelectable != null && RequiredSelectable.IsSelected == false) { return; } if (RequiredMouseButton >= 0 && LeanInput.GetMousePressed(RequiredMouseButton) == false) { return; } var finalDelta = LeanInput.GetMouseWheelDelta(); if (finalDelta == 0.0f) { return; } switch (Modify) { case ModifyType.Sign: { finalDelta = Mathf.Sign(finalDelta); } break; } finalDelta *= Multiplier; switch (Coordinate) { case CoordinateType.OneBased: { finalDelta += 1.0f; } break; } if (onDelta != null) { onDelta.Invoke(finalDelta); } }