FairyGUI.GObject.GlobalToLocal C# (CSharp) Method

GlobalToLocal() public method

Transforms a point from global (Stage) coordinates to the local coordinate system.
public GlobalToLocal ( Vector2 pt ) : Vector2
pt UnityEngine.Vector2
return UnityEngine.Vector2
        public Vector2 GlobalToLocal(Vector2 pt)
        {
            pt = displayObject.GlobalToLocal(pt);
            if (_pivotAsAnchor)
            {
                pt.x -= _width * _pivotX;
                pt.y -= _height * _pivotY;
            }
            return pt;
        }

Same methods

GObject::GlobalToLocal ( Rect rect ) : Rect

Usage Example

示例#1
0
        void __touchBegin(EventContext context)
        {
            if (Stage.inst.touchCount > 1)
            {
                Stage.inst.onTouchMove.Remove(__touchMove);
                Stage.inst.onTouchEnd.Remove(__touchEnd);
                if (_started)
                {
                    _started = false;
                    onEnd.Call(context.inputEvent);
                }
                return;
            }

            InputEvent evt = context.inputEvent;

            _startPoint = _host.GlobalToLocal(new Vector2(evt.x, evt.y));
            _lastPoint  = _startPoint;
            _throwPoint = _startPoint;

            _time2   = _time = Time.time;
            _started = false;
            velocity = Vector2.zero;
            position = Vector2.zero;

            Stage.inst.onTouchMove.Add(__touchMove);
            Stage.inst.onTouchEnd.Add(__touchEnd);
        }
All Usage Examples Of FairyGUI.GObject::GlobalToLocal