Пример #1
0
        public bool MouseButtonReleased(EMouseAction mouseAction, bool withinBounds)
        {
            switch (mouseAction)
            {
            // once box has been created and released, send out event with box dimensions
            case EMouseAction.LeftClick:
                if (mBoxExists)
                {
                    mBoxExists = false;

                    // if not an "accidental selection box" send out bounds
                    // mil unit checks if intersected and sets its selected bool as true if yet
                    if (mSizeBox.X > 2 && mSizeBox.Y > 2)
                    {
                        mXStart = mStartBox.X;
                        mYStart = mStartBox.Y;
                        if (MouseCoordinates().X < mStartBox.X)
                        {
                            mXStart = MouseCoordinates().X;
                        }

                        if (MouseCoordinates().Y < mStartBox.Y)
                        {
                            mYStart = MouseCoordinates().Y;
                        }

                        OnSelectingBox();
                    }
                    return(false);
                }
                return(true);
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        public Plotter()
        {
            InitializeComponent();

            m_Values      = new List <PlotterValues>();
            m_Markers     = new List <LogValue>();
            m_Time        = DateTime.MinValue;
            m_DrawScale   = 10.0;
            m_ValueHeight = 100.0;
            m_MouseAction = EMouseAction.None;

            m_CurvePen  = new Pen(Color.LightGray);
            m_DotPen    = new Pen(Color.White);
            m_DelimPen  = new Pen(Color.Black);
            m_MarkerPen = new Pen(Color.Yellow);

            m_GridPens = new List <Pen>();

            m_GridPens.Add(new Pen(Color.Cyan));        // 100th of second
            m_GridPens.Add(new Pen(Color.Yellow));      // Second
            m_GridPens.Add(new Pen(Color.Black));       // Minute
            m_GridPens.Add(new Pen(Color.LightGray));   // Hour

            m_MarkerBrush = new SolidBrush(Color.Yellow);
        }
Пример #3
0
        public bool MouseWheelValueChanged(EMouseAction mouseAction)
        {
            // enabled only if
            //  - the mouse is above the scrollable part of the window
            //  - the window is scrollable (the number of items is too big for one window)
            if (!(mMouseX > Position.X) || !(mMouseX < Position.X + mSize.X) || !(mMouseY > Position.Y) ||
                !(mMouseY < Position.Y + mSize.Y) || !mScrollable || !Active)
            {
                return(true);
            }

            // scroll up or down
            switch (mouseAction)
            {
            case EMouseAction.ScrollUp:
                if (!(mItemPosTop.Y > mScissorRectangle.Y))
                // stop from overflowing
                {
                    mItemPosTop.Y += +10;
                }
                break;

            case EMouseAction.ScrollDown:
                if (!(mItemPosBottom.Y < mScissorRectangle.Y + mScissorRectangle.Height + 10))
                // stop from overflowing
                {
                    mItemPosTop.Y += -10;
                }
                break;
            }

            return(false);
        }
Пример #4
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="mouseAction"></param>
        /// <returns></returns>
        public bool MouseWheelValueChanged(EMouseAction mouseAction)
        {
            // enabled only if
            //  - the mouse is above the scrollable part of the window
            //  - the window is not minimized
            //  - the window is scrollable (the number of items is too big for one window)
            //  - the window is active
            if (mMouseX > Position.X && mMouseX < Position.X + Size.X && mMouseY > Position.Y &&
                mMouseY < Position.Y + Size.Y && !mMinimized && mScrollable && Active)
            {
                // scroll up or down
                switch (mouseAction)
                {
                case EMouseAction.ScrollUp:
                    if (!(mItemPosTop.Y > Position.Y + mTitleSizeY + 1.5 * mMinimizationSize))
                    // stop from overflowing
                    {
                        mItemScrolledValue += +10;

                        // catch scroll-value being too big for the window
                        if (mItemPosTop.Y + 10 > Position.Y + mTitleSizeY + 1.5 * mMinimizationSize)
                        {
                            mItemScrolledValue += (int)(Position.Y + mTitleSizeY + 1.5 * mMinimizationSize - mItemPosTop.Y);
                        }
                    }
                    break;

                case EMouseAction.ScrollDown:
                    if (!(mItemPosBottom.Y < Position.Y + Size.Y))
                    // stop from overflowing
                    {
                        mItemScrolledValue += -10;

                        // catch scroll-value being too small for the window
                        if (mItemPosBottom.Y - 10 < Position.Y + Size.Y - 5)
                        {
                            mItemScrolledValue = -(int)(Position.Y + mTitleSizeY + 2 * mMinimizationSize + mCombinedItemsSize - (Position.Y + Size.Y));
                        }
                    }
                    break;
                }

                return(!Active);
            }

            // everything following handles if the input is given through or not

            if (!mMinimized && (mMouseX > Position.X && mMouseX < Position.X + Size.X) && mMouseY > Position.Y && mMouseY < Position.Y + Size.Y)
            // not minimized + mouse on window
            {
                return(!Active);
            }

            // resharper wanted it this 'overseeable' way o.O
            // minimized + mouse on minimized window -> return false ... else true
            return(!Active || !mMinimized || (!(mMouseX > Position.X) || !(mMouseX < mMinimizedBorderRectangle.X + mMinimizedBorderRectangle.Width)) || !(mMouseY > Position.Y) || !(mMouseY < mMinimizedBorderRectangle.Y + mMinimizedBorderRectangle.Height));
        }
Пример #5
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="mouseAction"></param>
        /// <param name="withinBounds"></param>
        /// <returns></returns>
        public bool MouseButtonPressed(EMouseAction mouseAction, bool withinBounds)
        {
            #region window movement

            if (mClickOnTitleBar && Active)
            // enable single window movement + no reaction when deactivated
            {
                // backup old window position to calculate the movement
                var positionOld = Position;

                // update window position
                Position = new Vector2(mMouseX - mWindowDragPos.X, mMouseY - mWindowDragPos.Y);

                #region catch window moving out of screen
                // catch left / right
                if (Position.X < 0)
                {
                    Position = new Vector2(0, Position.Y);
                }
                else if (Position.X + Size.X > mCurrentScreenWidth)
                {
                    Position = new Vector2(mCurrentScreenWidth - Size.X, Position.Y);
                }

                // catch top / bottom
                if (!mMinimized)
                // full window
                {
                    if (Position.Y < 0)
                    {
                        Position = new Vector2(Position.X, 0);
                    }
                    else if (Position.Y + Size.Y > mCurrentScreenHeight)
                    {
                        Position = new Vector2(Position.X, mCurrentScreenHeight - Size.Y);
                    }
                }
                else
                // minimized window
                {
                    if (Position.Y < 0)
                    {
                        Position = new Vector2(Position.X, 0);
                    }
                    else if (Position.Y + mMinimizedBorderRectangle.Height > mCurrentScreenHeight)
                    {
                        Position = new Vector2(Position.X, mCurrentScreenHeight - Size.Y);
                    }
                }
                #endregion
            }

            #endregion

            return(!Active);
        }
Пример #6
0
        public bool MouseButtonPressed(EMouseAction mouseAction, bool withinBounds)
        {
            if (mouseAction != EMouseAction.LeftClick || WindowIsInactive)
            {
                return true;
            }

            mDirector.GetStoryManager.Level.Camera.CenterOn(new Vector2(mMouseX * mDownscaleFactor, mMouseY * mDownscaleFactor));
            return false;
        }
Пример #7
0
        public bool MouseButtonReleased(EMouseAction mouseAction, bool withinBounds)
        {
            switch (mouseAction)
            {
            // once left button is released, release slider as slave from mouse
            case EMouseAction.LeftClick:
                mSlave = false;
                return(false);
            }

            return(true);
        }
Пример #8
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="mouseAction"></param>
        /// <param name="withinBounds"></param>
        /// <returns></returns>
        public bool MouseButtonReleased(EMouseAction mouseAction, bool withinBounds)
        {
            if (!Active)
            // window deactivated
            {
                return(true);
            }

            mClickOnTitleBar = false;

            // still return true so that the selection box can end
            return(true);
        }
Пример #9
0
 //============================================================
 private void pbxViewer_MouseDown(object sender, MouseEventArgs e)
 {
     if (MouseButtons.Right == e.Button)
     {
         // 设置鼠标状态
         _mouseAction = EMouseAction.Drag;
         // 设置鼠标样式
         Cursor            = Cursors.Hand;
         pbxViewer.Capture = true;
         // 储存视窗位置
         _scrollPosition.Set(-pbxViewer.Left, -pbxViewer.Top);
         // 储存鼠标点击位置
         _mousePosition.Set(e.X + pbxViewer.Left, e.Y + pbxViewer.Top);
     }
 }
Пример #10
0
        public bool MouseWheelValueChanged(EMouseAction mouseAction)
        {
            var scrollChange = 0f;

            switch (mouseAction)
            {
            case EMouseAction.ScrollUp:
                scrollChange = 0.1f;
                break;

            case EMouseAction.ScrollDown:
                scrollChange = -0.1f;
                break;
            }
            ZoomToTarget(new Vector2(mMouseX, mMouseY), scrollChange * Zoom);

            return(false);
        }
Пример #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                if ((Control.ModifierKeys & Keys.Control) != 0)
                {
                    DateTime aTime = m_Time.AddSeconds(e.X / m_DrawScale);
                    m_Markers.Add(new LogValue(aTime, 0.0));

                    Invalidate();
                }
                else
                {
                    m_MouseAction = EMouseAction.Moving;
                }
            }
            else if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                if ((Control.ModifierKeys & Keys.Control) != 0)
                {
                    foreach (LogValue aValue in m_Markers)
                    {
                        int Position = (int)TimeToPosition(aValue.Time);
                        int Delta    = Math.Abs(e.X - Position);
                        if (Delta < 5)
                        {
                            m_Markers.Remove(aValue);

                            Invalidate();
                            break;
                        }
                    }
                }
                else
                {
                    m_MouseAction = EMouseAction.Scaling;
                }
            }

            m_PreviousMousePosition = m_MousePosition = new Point(e.X, e.Y);
            m_Pivot = new Point(e.X, e.Y);
        }
 // 响应鼠标事件
 void ProcessEvent()
 {
     mInterceptMouse = clipRect.Contains(Event.current.mousePosition);
     if (!mInterceptMouse)
     {
         return;
     }
     if (Event.current.type == EventType.KeyDown)
     {
         InteractKeyDown(Event.current.keyCode);
     }
     else if (Event.current.type == EventType.KeyUp)
     {
         InteractKeyUp(Event.current.keyCode);
     }
     if (Event.current.type == EventType.MouseDrag)
     {
         if (mouseAction == EMouseAction.none)
         {
             mouseButton = (EMouseButton)Event.current.button;
             mouseAction = EMouseAction.drag;
             InteractDragBegin(mouseButton, GlobalMousePosition);
         }
         if (mouseAction == EMouseAction.drag)
         {
             InteractDrag(mouseButton, GlobalMousePosition, mouseDeltaPos);
         }
     }
     else if (Event.current.type == EventType.MouseUp)
     {
         if (mouseAction == EMouseAction.none)
         {
             mouseButton = (EMouseButton)Event.current.button;
             mouseAction = EMouseAction.click;
             InteractMouseClick(mouseButton, GlobalMousePosition);
         }
         else if (mouseAction == EMouseAction.drag)
         {
             InteractDragEnd(mouseButton, GlobalMousePosition);
         }
         mouseAction = EMouseAction.none;
     }
 }
Пример #13
0
        // TODO not woriking, wont print debug message
        public bool MouseButtonClicked(EMouseAction mouseAction, bool withinBounds)
        {
            switch (mouseAction)
            {
            // when left key is pressed and mouse within slider bounds then make slider slave to mouse
            case EMouseAction.LeftClick:

                if (Mouse.GetState().X >= mCurrentX - Size.Y / 2 &&
                    Mouse.GetState().X <= mCurrentX + Size.Y / 2 &&
                    Mouse.GetState().Y >= Position.Y - Size.Y / 2 &&
                    Mouse.GetState().Y <= Position.Y + Size.Y / 2)
                {
                    mSlave = true;
                    return(false);
                }

                break;
            }

            return(true);
        }
Пример #14
0
        public bool MouseButtonClicked(EMouseAction mouseAction, bool withinBounds)
        {
            switch (mouseAction)
            {
            // if left click and selection box doesnt exist then create one
            case EMouseAction.LeftClick:
                if (!mBoxExists)
                {
                    mBoxExists = true;
                    mStartBox  = MouseCoordinates();
                    mSizeBox   = new Vector2(0, 0);
                    // can also be a simple click without a selection box, therefore pass on input
                    return(true);
                }

                else
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #15
0
 public bool MouseButtonReleased(EMouseAction mouseAction, bool withinBounds)
 {
     return(true);
 }
Пример #16
0
        public bool MouseButtonClicked(EMouseAction mouseAction, bool withinBounds)
        {
            var giveThrough = true;

            switch (mouseAction)
            {
            case EMouseAction.LeftClick:
                // check for if the unit is selected, not moving, the click is not within the bounds of the unit, and the click was on the map.
                if (Selected
                    // && !Moved // now this should do pathfinding even while moving
                    && !withinBounds &&
                    Map.Map.IsOnTop(new Rectangle((int)(mMouseX - RelativeSize.X / 2f),
                                                  (int)(mMouseY - RelativeSize.Y / 2f),
                                                  (int)RelativeSize.X,
                                                  (int)RelativeSize.Y),
                                    mCamera))
                {
                    if (!mGroup.IsPresent())
                    {
                        var group = Optional <FlockingGroup> .Of(mDirector.GetMilitaryManager.GetNewFlock());

                        group.Get().AssignUnit(this);
                        mGroup = group;
                        // do the f**k not change these lines here. Costs you at least 3h for debugging.
                    }

                    var target = Vector2.Transform(new Vector2(Mouse.GetState().X, Mouse.GetState().Y),
                                                   Matrix.Invert(mCamera.GetTransform()));

                    if (mGroup.Get().Map.GetCollisionMap().GetWalkabilityGrid().IsWalkableAt(
                            (int)target.X / MapConstants.GridWidth,
                            (int)target.Y / MapConstants.GridHeight))
                    {
                        mGroup.Get().FindPath(target);
                    }
                }


                if (withinBounds)
                {
                    Selected    = true;
                    giveThrough = false;

                    if (!mGroup.IsPresent())
                    {
                        var group = Optional <FlockingGroup> .Of(mDirector.GetMilitaryManager.GetNewFlock());

                        group.Get().AssignUnit(this);
                        mGroup = group;
                        // do the f**k not change these lines here. Costs you at least 3h for debugging.
                    }
                    else if (!mGroup.Get().AllSelected())
                    {
                        var group = Optional <FlockingGroup> .Of(mDirector.GetMilitaryManager.GetNewFlock());

                        group.Get().AssignUnit(this);
                        mGroup = group;
                    }
                }

                break;

            case EMouseAction.RightClick:
                Selected = false;
                break;
            }

            return(giveThrough);
        }
Пример #17
0
        public bool MouseButtonClicked(EMouseAction mouseAction, bool withinBounds)
        {
            var giveThrough = true;

            if (mouseAction == EMouseAction.LeftClick)
            {
                switch (mCurrentState.GetState())
                {
                case 1:
                    if (!mIsRoadPlacement)
                    {
                        mPlatform.UpdateValues();

                        //first check if the platform is even on the map, if not we don't want to progress, since it isn't a valid position
                        if (!Map.Map.IsOnTop(mPlatform.AbsBounds) || mHoveringPlatform != null || mNatureObjectThere)
                        {
                            break;
                        }

                        // the platform was on the map -> advance to next state and create the road to connect to another platform
                        mCurrentState.NextState();
                        mConnectionRoad = new Road(mPlatform, null, ref mDirector, true);

                        giveThrough = false;
                    }
                    else
                    {
                        if (mHoveringPlatform != null)
                        {
                            mRoadToBuild = new Road(mHoveringPlatform, null, ref mDirector, true);
                            mOldHovering = mHoveringPlatform;
                            mCurrentState.NextState();
                            giveThrough = false;
                        }
                    }

                    break;


                case 2:
                    if (!mIsRoadPlacement)
                    {
                        if (mHoveringPlatform == null || !mHoveringPlatform.Friendly)
                        {
                            break;
                        }

                        // this limits two platforms to only be connectable by a road if the road isn't in the fog of war this was requested by felix
                        if (Vector2.Distance(mHoveringPlatform.Center, mPlatform.Center) <=
                            mPlatform.RevelationRadius + mHoveringPlatform.RevelationRadius)
                        {
                            mCurrentState.NextState();
                        }

                        giveThrough = false;
                    }
                    else
                    {
                        if (mHoveringPlatform == null || mHoveringPlatform.Equals(mOldHovering) || !mHoveringPlatform.Friendly)
                        {
                            break;
                        }

                        mRoadToBuild.DestinationAsNode = mHoveringPlatform;
                        mRoadToBuild.Destination       = mHoveringPlatform.Center;
                        mHoveringPlatform.AddBlueprint(new BuildBluePrint(mHoveringPlatform, mRoadToBuild, ref mDirector));
                        mCurrentState.NextState();
                    }

                    break;
                }
            }

            if (mouseAction == EMouseAction.RightClick)
            {
                if (mCurrentState.GetState() == 1)
                {
                    mDirector.GetUserInterfaceController.BuildingProcessFinished();
                    mCanceled   = true;
                    mIsFinished = true;
                    giveThrough = false;
                    mUnregister = true;

                    // ReSharper disable once ConditionIsAlwaysTrueOrFalse
                    // Done for consistency
                    return(giveThrough);
                }

                // we only need to do something with rightclick if were in the 2nd state, since then we revert.
                if (mCurrentState.GetState() != 2)
                {
                    return(giveThrough);
                }

                if (!mIsRoadPlacement)
                {
                    // make sure to reset colors when reverting to the last state. The rest is just some cleanup to properly
                    // get to the previous state
                    mPlatform.ResetColor();
                    mConnectionRoad = null;
                    mCurrentState.PreviousState();
                    giveThrough = false;
                }
                else
                {
                    mRoadToBuild = null;
                    mCurrentState.PreviousState();
                    giveThrough = false;
                }
            }

            return(giveThrough);
        }
Пример #18
0
        private void EngineViewPanel_MouseCallback(int x, int y, int Button, EMouseAction Action)
        {
            if (Button == 0)
            {
                if (Action == EngineAPI.EMouseAction.Down)
                {
                    DraggedTpl = null;

                    if (bSelectByMouse.Checked)
                    {
                        string UID = EngineAPI.Entities.GetUIDUnderMouse();
                        if (Entities.ContainsKey(UID))
                        {
                            tcLevelsObjects.SelectTab(tpEntities);
                            if (CurrEntity == null || UID != CurrEntity.Uid) DontFocusOnEntity = true;
                            tvEntities.SelectedNode = Entities[UID].UiNode; // Causes tvEntities_AfterSelect
                        }
                    }
                }
                else if (Action == EngineAPI.EMouseAction.Up && DraggedTpl != null)
                {
                    string TplName = DraggedTpl.Name;
                    string UIDBase = CurrLevelID + "_" + TplName + "_";
                    string UID = UIDBase + EngineAPI.Entities.GetNextFreeUIDOnLevel(UIDBase).ToString();
                    string CatName = DraggedTpl.Parent.Name;
                    Category Cat = EntityCats[CatName];
                    Entity NewEnt = new Entity(UID, Cat, false);
                    if (NewEnt.CreateFromTemplate(TplName, CurrLevelID, true))
                    {
                        AddEntity(NewEnt);
                        tvEntities.SelectedNode = NewEnt.UiNode;
                    }
                    else MessageBox.Show("Не удалось создать новый объект!");

                    DraggedTpl = null;
                }
            }
        }
Пример #19
0
        // 响应鼠标事件
        void ProcessEvent()
        {
            mInterceptMouse = clipRect.Contains(Event.current.mousePosition);
            if (!mInterceptMouse)
            {
                return;
            }
            if (Event.current.type == EventType.KeyDown)
            {
                OnKeyDown();
            }
            else if (Event.current.type == EventType.KeyUp)
            {
                OnKeyUp();
            }
            if (Event.current.type == EventType.MouseDrag)
            {
                if (mouseAction == EMouseAction.none)
                {
                    mouseButton = (EMouseButton)Event.current.button;
                    mouseAction = EMouseAction.drag;
                    OnDragBegin();
                }
                if (mouseAction == EMouseAction.drag)
                {
                    OnDrag();
                }
            }
            else if (Event.current.type == EventType.MouseUp)
            {
                if (mouseAction == EMouseAction.none)
                {
                    mouseButton = (EMouseButton)Event.current.button;
                    mouseAction = EMouseAction.click;
                    OnClick();
                }
                else if (mouseAction == EMouseAction.drag)
                {
                    OnDragEnd();
                }
                mouseAction = EMouseAction.none;
            }

            if (Event.current.type == EventType.ScrollWheel)
            {
                Vector2 cen = Vector2.zero;
                if (!Event.current.control)
                {
                    cen = GraphCanvas.Parent.CalculateLocalPosition(GlobalMousePosition);
                }
                float f = Mathf.Clamp(ScaledCanvas.LocalScale - Event.current.delta.y * ScaledCanvas.LocalScale * 0.05f, mMinScale, mMaxScale);
                if ((f < 1 && ScaledCanvas.LocalScale > 1) || (f > 1 && ScaledCanvas.LocalScale < 1))
                {
                    f = 1;
                }
                ScaledCanvas.LocalScale = f;
                if (!Event.current.control)
                {
                    Vector2 p     = GraphCanvas.Parent.CalculateLocalPosition(GlobalMousePosition);
                    Vector2 delta = p - cen;
                    Rect    r     = GraphCanvas.LocalRect;
                    r.position           += delta;
                    GraphCanvas.LocalRect = r;
                }
                UpdateStateInfo();
            }
        }
Пример #20
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="mouseAction"></param>
        /// <param name="withinBounds"></param>
        /// <returns></returns>
        public bool MouseButtonClicked(EMouseAction mouseAction, bool withinBounds)
        {
            if (mouseAction == EMouseAction.LeftClick && withinBounds && Active)
            {
                #region minimization

                if (mMouseX >= mMinimizationRectangle.X &&
                    mMouseX < mMinimizationRectangle.X + mMinimizationSize &&
                    mMouseY >= mMinimizationRectangle.Y &&
                    mMouseY < mMinimizationRectangle.Y + mMinimizationSize)
                // mouse on minimization rectangle
                {
                    if (!mMinimized && mMinimizable)
                    // window IS NOT minimized and it's minimizable
                    // -> use minimized rectangles
                    {
                        mMinimized = true;

                        // disable all items due to minimization
                        foreach (var item in mItemList)
                        {
                            item.ActiveInWindow = false;
                        }
                    }
                    else if (mMinimized)
                    // LeftClick on Minimize-Button, window IS minimized
                    // -> use regular rectangles + move window back in screen if outside
                    {
                        mMinimized = false;

                        // enable all items due to maximization
                        foreach (var item in mItemList)
                        {
                            item.ActiveInWindow = true;
                        }

                        // catch window being out of screen at the bottom after maximization
                        if (Position.Y + Size.Y > mCurrentScreenHeight)
                        {
                            // reset window position
                            Position = new Vector2(Position.X, mCurrentScreenHeight - Size.Y);
                        }
                    }
                }

                #endregion

                #region window movement initiation

                if (mMouseX > Position.X &&
                    mMouseX < Position.X + Position.X + Size.X &&
                    mMouseY > Position.Y &&
                    mMouseY < Position.Y + mTitleSizeY + mMinimizationSize &&
                    !mClickOnTitleBar ||
                    (WindowName == "" &&
                     mMouseX > Position.X &&
                     mMouseX < Position.X + Position.X + Size.X &&
                     mMouseY > Position.Y &&
                     mMouseY < Position.Y + Position.Y + Size.Y &&
                     !mClickOnTitleBar))
                // mouse above the title rectangle
                {
                    if (!(mMouseX >= mMinimizationRectangle.X &&
                          mMouseX < mMinimizationRectangle.X + mMinimizationSize &&
                          mMouseY >= mMinimizationRectangle.Y &&
                          mMouseY < mMinimizationRectangle.Y + mMinimizationSize))
                    // mouse not on minimization rectangle (no movement when pressing the minimization rectangle)
                    {
                        mClickOnTitleBar = true;

                        // set 'previous mouse position'
                        mWindowDragPos = new Vector2(mMouseX - Position.X, mMouseY - Position.Y);
                    }
                }

                #endregion
            }

            #region handle input givethrough

            if (!mMinimized && (mMouseX > Position.X && mMouseX < Position.X + Size.X) && mMouseY > Position.Y && mMouseY < Position.Y + Size.Y)
            // not minimized + mouse on window
            {
                return(!Active);
            }

            // resharper wanted it this 'overseeable' way o.O
            // minimized + mouse on minimized window -> return false ... else true
            return(!Active || !(mMinimized && mMouseX > Position.X && mMouseX < mMinimizedBorderRectangle.X + mMinimizedBorderRectangle.Width &&
                                mMouseY > Position.Y && mMouseY < mMinimizedBorderRectangle.Y + mMinimizedBorderRectangle.Height));

            #endregion
        }
Пример #21
0
 public bool MouseButtonClicked(EMouseAction mouseAction, bool withinBounds)
 {
     return true;
 }
        private void SetMouseAction(EMouseAction action)
        {
            if (action == mouseAction)
                action = EMouseAction.None;

            mouseAction = action;

            tsBtnChooseGraphColor.Checked = (mouseAction == EMouseAction.ChooseGraphColor);
            tsBtnChooseStartingpoint.Checked = (mouseAction == EMouseAction.ChooseStartingPoint);
            tsBtnChooseSize.Checked = (mouseAction == EMouseAction.ChooseGraphSize);
        }
Пример #23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            m_MouseAction = EMouseAction.None;
        }
Пример #24
0
 //============================================================
 private void pbxViewer_MouseUp(object sender, MouseEventArgs e)
 {
     _mouseAction      = EMouseAction.Unknown;
     Cursor            = Cursors.Default;
     pbxViewer.Capture = false;
 }
Пример #25
0
 public bool MouseButtonPressed(EMouseAction mouseAction, bool withinBounds)
 {
     return(!withinBounds);
 }