Fix number slider not working in camera canvas mode.
This commit is contained in:
@@ -75,6 +75,7 @@ namespace Cryville.Crtr.Browsing {
|
||||
}
|
||||
#pragma warning restore IDE0051
|
||||
|
||||
Camera cam;
|
||||
Vector2 pp;
|
||||
bool use, nouse;
|
||||
public void OnInitializePotentialDrag(PointerEventData eventData) {
|
||||
@@ -84,6 +85,7 @@ namespace Cryville.Crtr.Browsing {
|
||||
|
||||
public void OnDrag(PointerEventData eventData) {
|
||||
if (nouse) return;
|
||||
cam = eventData.pressEventCamera;
|
||||
if (!use) {
|
||||
var delta = eventData.position - pp;
|
||||
float dx = Mathf.Abs(delta.x), dy = Mathf.Abs(delta.y);
|
||||
@@ -116,7 +118,7 @@ namespace Cryville.Crtr.Browsing {
|
||||
|
||||
float GetRatioFromPos(Vector2 pos) {
|
||||
Vector2 lp;
|
||||
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(m_handleArea, pos, null, out lp)) {
|
||||
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(m_handleArea, pos, cam, out lp)) {
|
||||
lp -= m_handleArea.rect.position;
|
||||
return Mathf.Clamp01(lp.x / m_handleArea.rect.width);
|
||||
}
|
||||
|
Reference in New Issue
Block a user