Пример #1
0
        // called when Parent.LayoutDirty == true
        public void SetPosition(Vector2 position, Vector2 direction, bool instant)
        {
            var anchor = Transform.anchorMin;
            var pivot  = Transform.pivot;

            position += new Vector2(pivot.x * PaddedSize.x, (1 - pivot.y) * -PaddedSize.y) * direction;
            var marginX = (1 - anchor.x) * Margin.Left + anchor.x * -Margin.Right;
            var marginY = (1 - anchor.y) * Margin.Bottom + anchor.y * -Margin.Top;

            position += new Vector2(marginX, marginY);
            Positioner.SetTargetPosition(position, instant);
        }