Ejemplo n.º 1
0
 public static float ConvertToWorld(float value, TouchUnitType unitType)
 {
     return(value * (unitType == TouchUnitType.Pixels ? PixelToWorld : PercentToWorld));
 }
Ejemplo n.º 2
0
 public static Rect ConvertToWorld(Rect rect, TouchUnitType unitType)
 {
     return(unitType == TouchUnitType.Pixels ? PixelToWorldRect(rect) : PercentToWorldRect(rect));
 }
Ejemplo n.º 3
0
 protected Vector3 OffsetToWorldPosition( TouchControlAnchor anchor, Vector2 offset, TouchUnitType offsetUnitType, bool lockAspectRatio )
 {
     Vector3 worldOffset;
     if (offsetUnitType == TouchUnitType.Pixels)
     {
         worldOffset = TouchUtility.RoundVector( offset ) * TouchManager.PixelToWorld;
     }
     else
     {
         if (lockAspectRatio)
         {
             worldOffset = (Vector3) offset * TouchManager.PercentToWorld;
         }
         else
         {
             worldOffset = Vector3.Scale( offset, TouchManager.ViewSize );
         }
     }
     return TouchManager.ViewToWorldPoint( TouchUtility.AnchorToViewPoint( anchor ) ) + worldOffset;
 }
Ejemplo n.º 4
0
        protected Vector3 OffsetToWorldPosition(TouchControlAnchor anchor, Vector2 offset, TouchUnitType offsetUnitType, bool lockAspectRatio)
        {
            Vector3 worldOffset;

            if (offsetUnitType == TouchUnitType.Pixels)
            {
                worldOffset = TouchUtility.RoundVector(offset) * TouchManager.PixelToWorld;
            }
            else
            {
                if (lockAspectRatio)
                {
                    worldOffset = (Vector3)offset * TouchManager.PercentToWorld;
                }
                else
                {
                    worldOffset = Vector3.Scale(offset, TouchManager.ViewSize);
                }
            }
            return(TouchManager.ViewToWorldPoint(TouchUtility.AnchorToViewPoint(anchor)) + worldOffset);
        }
Ejemplo n.º 5
0
        protected Vector3 OffsetToWorldPosition(TouchControlAnchor anchor, Vector2 offset, TouchUnitType offsetUnitType, bool lockAspectRatio)
        {
            Vector3 b = (offsetUnitType == TouchUnitType.Pixels) ? ((Vector3)(TouchUtility.RoundVector(offset) * TouchManager.PixelToWorld)) : ((!lockAspectRatio) ? Vector3.Scale(offset, TouchManager.ViewSize) : ((Vector3)offset * TouchManager.PercentToWorld));

            return(TouchManager.ViewToWorldPoint(TouchUtility.AnchorToViewPoint(anchor)) + b);
        }