Beispiel #1
0
        public override void OnUpdate(MainDisplay owner)
        {
            base.OnUpdate(owner);

            if (Active)
            {
                Vector2 mouseDelta = owner.WorldMousePosition - initialPressedPos;

                if (mouseDelta.X != 0 || mouseDelta.Y != 0)
                {
                    if (!owner.BottomPanelHidden)
                    {
                        owner.HideBottomPanel();
                        hidBottomPanel = true;
                    }
                    if (!owner.TopPanelHidden)
                    {
                        owner.HideTopPanel();
                        hidTopPanel = true;
                    }
                }

                mouseDelta = mouseDelta.Negative;

                owner.Camera.Move(mouseDelta);
            }
        }
Beispiel #2
0
        public override void OnUpdate(MainDisplay owner)
        {
            base.OnUpdate(owner);

            if (Active)
            {
                SelectRect.Left   = _initialPressedPos.X;
                SelectRect.Top    = _initialPressedPos.Y;
                SelectRect.Right  = owner.WorldMousePosition.X;
                SelectRect.Bottom = owner.WorldMousePosition.Y;

                if (SelectRect.Width != 0 && SelectRect.Height != 0)
                {
                    owner.HideTopPanel();


                    var oldDraggingRectangle = SelectRect;
                    SelectRect.Left   = MathHelper.Min(oldDraggingRectangle.Left, SelectRect.Right);
                    SelectRect.Right  = MathHelper.Max(oldDraggingRectangle.Left, SelectRect.Right);
                    SelectRect.Top    = MathHelper.Min(oldDraggingRectangle.Top, SelectRect.Bottom);
                    SelectRect.Bottom = MathHelper.Max(oldDraggingRectangle.Top, SelectRect.Bottom);

                    if (owner.CurrentSpriteSheet.Frames.Count > 0)
                    {
                        foreach (var frame in owner.CurrentSpriteSheet.Frames)
                        {
                            owner.CurrentSpriteSheet.SelectFrame(frame,
                                                                 SelectRect.Intersects(frame.RelativeBoundingRect));
                        }
                    }
                }
            }
        }