修改滚动视图逻辑
This commit is contained in:
@@ -27,8 +27,9 @@ namespace MuHua {
|
|||||||
FromRightToLeft = 1,
|
FromRightToLeft = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
public float value;
|
|
||||||
public bool isDrag;
|
public bool isDrag;
|
||||||
|
public float value;
|
||||||
|
public float rolling = 10;
|
||||||
public Vector3 originalPosition;
|
public Vector3 originalPosition;
|
||||||
public Vector3 pointerPosition;
|
public Vector3 pointerPosition;
|
||||||
|
|
||||||
@@ -76,9 +77,10 @@ namespace MuHua {
|
|||||||
}
|
}
|
||||||
/// <summary> 滚轮滑动 </summary>
|
/// <summary> 滚轮滑动 </summary>
|
||||||
private void ViewportWheel(WheelEvent evt) {
|
private void ViewportWheel(WheelEvent evt) {
|
||||||
float maxHeight = Viewport.resolvedStyle.height - Container.resolvedStyle.height;
|
// float maxHeight = Viewport.resolvedStyle.height - Container.resolvedStyle.height;
|
||||||
float minHeight = Mathf.Min(Viewport.resolvedStyle.height, Container.resolvedStyle.height);
|
// float minHeight = Mathf.Min(Viewport.resolvedStyle.height, Container.resolvedStyle.height);
|
||||||
float y = evt.delta.y * minHeight / maxHeight;
|
// float y = evt.delta.y * minHeight / maxHeight;
|
||||||
|
float y = evt.delta.y * rolling;
|
||||||
value = value - y;
|
value = value - y;
|
||||||
UpdateValue(value);
|
UpdateValue(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,9 @@ namespace MuHua {
|
|||||||
FromBottomToTop = 1,
|
FromBottomToTop = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
public float value;
|
|
||||||
public bool isDrag;
|
public bool isDrag;
|
||||||
|
public float value;
|
||||||
|
public float rolling = 10;
|
||||||
public Vector3 originalPosition;
|
public Vector3 originalPosition;
|
||||||
public Vector3 pointerPosition;
|
public Vector3 pointerPosition;
|
||||||
|
|
||||||
@@ -76,9 +77,10 @@ namespace MuHua {
|
|||||||
}
|
}
|
||||||
/// <summary> 滚轮滑动 </summary>
|
/// <summary> 滚轮滑动 </summary>
|
||||||
private void ViewportWheel(WheelEvent evt) {
|
private void ViewportWheel(WheelEvent evt) {
|
||||||
float maxHeight = Viewport.resolvedStyle.height - Container.resolvedStyle.height;
|
// float maxHeight = Viewport.resolvedStyle.height - Container.resolvedStyle.height;
|
||||||
float minHeight = Mathf.Min(Viewport.resolvedStyle.height, Container.resolvedStyle.height);
|
// float minHeight = Mathf.Min(Viewport.resolvedStyle.height, Container.resolvedStyle.height);
|
||||||
float y = evt.delta.y * minHeight / maxHeight;
|
// float y = evt.delta.y * minHeight / maxHeight;
|
||||||
|
float y = evt.delta.y * rolling;
|
||||||
value = value - y;
|
value = value - y;
|
||||||
UpdateValue(value);
|
UpdateValue(value);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user