Example #1
0
        private void __mouseMove(object obj)
        {
            MouseEvent evt = (MouseEvent)obj;
            float      xx  = evt.StageX / GRoot.contentScaleFactor;
            float      yy  = evt.StageY / GRoot.contentScaleFactor;

            if (!ToolSet.IsEmptyRect(ref sDragBounds))
            {
                if (xx < sDragBounds.x || yy < sDragBounds.y ||
                    xx + _owner.width > sDragBounds.xMax ||
                    yy + _owner.height > sDragBounds.yMax)
                {
                    return;
                }
            }

            _owner.SetXY((int)(sLocalDragStart.x + xx - sGlobalDragStart.x),
                         (int)(sLocalDragStart.y + yy - sGlobalDragStart.y));
        }
Example #2
0
        public void ReplaceMe(GObject target)
        {
            if (_parent == null)
            {
                throw new Exception("parent not set");
            }

            target.name      = this.name;
            target.alpha     = _alpha;
            target.rotation  = _rotation;
            target.visible   = _visible;
            target.touchable = _touchable;
            target.grayed    = _grayed;
            target.SetXY(this.x, this.y);
            target.SetSize(this.width, this.height);

            int index = _parent.GetChildIndex(this);

            _parent.AddChildAt(target, index);
            target.relations.CopyFrom(this.relations);

            _parent.RemoveChild(this, true);
        }