Skip to content

Commit c9c4318

Browse files
committed
feat: Stage.mouseWheelScale
1 parent f7fcca6 commit c9c4318

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Assets/Scripts/Core/Stage.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ public static float devicePixelRatio
192192
get; set;
193193
}
194194

195+
/// <summary>
196+
/// The scale of the mouse scroll delta.
197+
/// </summary>
198+
public static float mouseWheelScale
199+
{
200+
get; set;
201+
}
202+
195203
/// <summary>
196204
///
197205
/// </summary>
@@ -231,6 +239,7 @@ public Stage() : base()
231239

232240
// 在PC上,是否retina屏对输入法位置,鼠标滚轮速度都有影响,但现在没发现Unity有获得的方式。仅判断是否Mac可能不够(外接显示器的情况)。所以最好自行设置。
233241
devicePixelRatio = (isOSX && Screen.dpi > 96) ? 2 : 1;
242+
mouseWheelScale = 1;
234243

235244
_rollOutChain = new List<DisplayObject>();
236245
_rollOverChain = new List<DisplayObject>();
@@ -976,7 +985,7 @@ internal void HandleGUIEvents(Event evt)
976985
if (_touchTarget != null)
977986
{
978987
TouchInfo touch = _touches[0];
979-
touch.mouseWheelDelta = evt.delta.y;
988+
touch.mouseWheelDelta = evt.delta.y * Stage.mouseWheelScale;
980989
touch.UpdateEvent();
981990
_touchTarget.BubbleEvent("onMouseWheel", touch.evt);
982991
touch.mouseWheelDelta = 0;

0 commit comments

Comments
 (0)