private void __touchMove2(EventContext context)
{
InputEvent evt = context.inputEvent;
if (_dragTouchId != -1 && _dragTouchId != evt.touchId || this.parent == null)
return;
if (displayObject == null || displayObject.isDisposed)
return;
float xx = evt.x - sGlobalDragStart.x + sGlobalRect.x;
float yy = evt.y - sGlobalDragStart.y + sGlobalRect.y;
if (dragBounds != null)
{
Rect rect = GRoot.inst.LocalToGlobal((Rect)dragBounds);
if (xx < rect.x)
xx = rect.x;
else if (xx + sGlobalRect.width > rect.xMax)
{
xx = rect.xMax - sGlobalRect.width;
if (xx < rect.x)
xx = rect.x;
}
if (yy < rect.y)
yy = rect.y;
else if (yy + sGlobalRect.height > rect.yMax)
{
yy = rect.yMax - sGlobalRect.height;
if (yy < rect.y)
yy = rect.y;
}
}
Vector2 pt = this.parent.GlobalToLocal(new Vector2(xx, yy));
if (float.IsNaN(pt.x))
return;
sUpdateInDragging = true;
this.SetXY(Mathf.RoundToInt(pt.x), Mathf.RoundToInt(pt.y));
sUpdateInDragging = false;
onDragMove.Call();
}