コード例 #1
0
ファイル: ColorOperation.cs プロジェクト: github188/myitoppsp
 internal ColorOperation(MouseArea mousecontrol)
 {
     this.mouseAreaControl = null;
     this.translatePath    = new GraphicsPath();
     this.scalePath        = new GraphicsPath();
     this.rotatePath       = new GraphicsPath();
     this.equalPath        = new GraphicsPath();
     this.skewxPath        = new GraphicsPath();
     this.skewyPath        = new GraphicsPath();
     this.anglescalePath   = new GraphicsPath();
     this.vscalPath        = new GraphicsPath();
     this.controlPoints    = null;
     this.reversePath      = new GraphicsPath();
     this.startPoint       = PointF.Empty;
     this.win32            = new Win32();
     this.ratiomatrix      = new Matrix();
     this.graphMatrix      = new Matrix();
     this.selectMatrix     = new Matrix();
     this.gradientMatrix   = new Matrix();
     this.gradientPath     = new GraphicsPath();
     this.gradientheight   = 1f;
     this.centerPoint      = PointF.Empty;
     this.gradientstr      = string.Empty;
     this.colorpickerstr   = string.Empty;
     this.mouseAreaControl = mousecontrol;
     this.win32            = mousecontrol.win32;
     this.gradientstr      = DrawAreaConfig.GetLabelForName("gradienttransform").Trim();
     this.colorpickerstr   = DrawAreaConfig.GetLabelForName("colorpicker").Trim();
 }
コード例 #2
0
 internal SubOperation(MouseArea mc, IPath path)
 {
     this.currentGraph     = null;
     this.mouseAreaControl = null;
     this.mouseAreaControl = mc;
     this.CurrentGraph     = path;
 }
コード例 #3
0
 internal SymbolOperation(MouseArea mousearea)
 {
     this.startPoint       = Point.Empty;
     this.oldleft          = 0f;
     this.oldtop           = 0f;
     this.mouseAreaControl = mousearea;
 }
コード例 #4
0
        public MouseArea CheckMouseArea()
        {
            Point absPosition    = Mouse.GetPosition(this);
            Point absTopLeft     = new Point(0.0, 0.0);
            Point absBottomRight = new Point(ActualWidth, ActualHeight);

            MouseArea area = MouseArea.None;

            if (absPosition.X < (absTopLeft.X + 4.0))
            {
                area |= MouseArea.Left;
            }
            if (absPosition.X > (absBottomRight.X - 4.0))
            {
                area |= MouseArea.Right;
            }
            if (absPosition.Y < (absTopLeft.Y + 4.0))
            {
                area |= MouseArea.Top;
            }
            if (absPosition.Y > (absBottomRight.Y - 4.0))
            {
                area |= MouseArea.Bottom;
            }

            return(area);
        }
コード例 #5
0
        private MouseArea CheckArea(ref int x, ref int y)
        {
            MouseArea area = MouseArea.Unknown;

            List <MouseAreaPosition> mouseAreaPositionList = new List <MouseAreaPosition>();

            mouseAreaPositionList.Add(new MouseAreaPosition(MouseArea.Status, 0, this.State.StatusLineRow * WindowManager.CharacterHeight, 40 * WindowManager.CharacterWidth, 1 * WindowManager.CharacterHeight));
            mouseAreaPositionList.Add(new MouseAreaPosition(MouseArea.Game, 0, this.State.WindowRowMin * WindowManager.CharacterHeight, 40 * WindowManager.CharacterWidth, 21 * WindowManager.CharacterHeight));
            mouseAreaPositionList.Add(new MouseAreaPosition(MouseArea.CommandEntry, 0, (this.State.WindowRowMin + 21) * WindowManager.CharacterHeight, 40 * WindowManager.CharacterWidth, 10 * WindowManager.CharacterHeight));

            foreach (MouseAreaPosition current in mouseAreaPositionList)
            {
                if (x >= current.X &&
                    x < (current.X + current.Width) &&
                    y >= current.Y &&
                    y < (current.Y + current.Height))
                {
                    area = current.Area;
                    x   -= current.X;
                    y   -= current.Y;
                    break;
                }
            }

            return(area);
        }
コード例 #6
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (null == ViewModel)
            {
                return;
            }

            Point mousePos = e.GetPosition(this);

            MouseArea area  = CheckMouseArea();
            Point     delta = new Point(mousePos.X - _PrevMousePos.X,
                                        mousePos.Y - _PrevMousePos.Y);

            if (NodeGraphManager.IsDragging)
            {
                UpdateDragging(mousePos, delta);
            }
            else
            {
                if (_IsDraggingCanvas)
                {
                    _ZoomAndPan.StartX -= delta.X;
                    _ZoomAndPan.StartY -= delta.Y;
                }
            }

            _PrevMousePos = mousePos;

            e.Handled = true;
        }
コード例 #7
0
 public MouseAreaPosition(MouseArea area, int x, int y, int width, int height)
 {
     this.Area   = area;
     this.X      = x;
     this.Y      = y;
     this.Width  = width;
     this.Height = height;
 }
コード例 #8
0
        /// <inheritdoc/>
        protected override void OnLeftMouseClicked(ControlMouseState info)
        {
            if (MouseArea.Contains(info.MousePosition))
            {
                SelectedCharacter = Surface[info.MousePosition.ToIndex(Width)].Glyph;
            }

            base.OnLeftMouseClicked(info);
        }
コード例 #9
0
ファイル: MapManager.cs プロジェクト: Minstreams/CallOfEvil
        /// <summary>
        /// 判定鼠标所处区域
        /// </summary>
        private void SetMouseArea()
        {
            Vector2 mousePos = Event.current.mousePosition;

            //判断顺序=遮挡关系
            //判定选中物体
            MapGroup group = GroupList[MapSystem.currentGroupIndex];

            if (group != null)
            {
                for (int i = 0; i < group.transform.childCount; i++)
                {
                    Vector2 guiPos = GetElementGUIPos(group.transform.GetChild(i).position);

                    if (Vector2.Distance(mousePos, guiPos) < Prefs.elementRadius)
                    {
                        areaIndex = i;
                        mouseArea = MouseArea.ObjectArea;
                        return;
                    }
                }
            }
            for (int i = 0; i < invalidObjectList.Count; i++)
            {
                Vector2 guiPos = GetElementGUIPos(invalidObjectList[i].transform.position);

                if (Vector2.Distance(mousePos, guiPos) < Prefs.elementRadius)
                {
                    areaIndex = -i - 1;
                    mouseArea = MouseArea.ObjectArea;
                    return;
                }
            }
            //判定在中心
            if (Vector2.Distance(mousePos, center) < Prefs.centerDiscRadius)
            {
                mouseArea = MouseArea.Center;
                return;
            }
            //判定在缩放区域
            if (mousePos.x < Prefs.sideWidth)
            {
                mouseArea = MouseArea.ScollArea;
                return;
            }
            //判定选中组
            if (Vector2.Distance(mousePos, center) < radius)
            {
                areaIndex = (int)(MapSystem.GetAngle(GetElementWorldPos(Event.current.mousePosition, 0)) / MapSystem.AnglePerGroup);
                mouseArea = MouseArea.GroupArea;
                return;
            }

            mouseArea = MouseArea.DragArea;
        }
コード例 #10
0
        /// <inheritdoc/>
        protected override void OnMouseIn(ControlMouseState info)
        {
            if (!MouseState_EnteredWithButtonDown && MouseArea.Contains(info.MousePosition) && info.OriginalMouseState.Mouse.LeftButtonDown)
            {
                if (!UseFullClick)
                {
                    SelectedCharacter = Surface[info.MousePosition.ToIndex(Width)].Glyph;
                }
            }

            base.OnMouseIn(info);
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: benjamin-allen/GridRL
 protected override void OnMouseClick(MouseEventArgs e)
 {
     if (!Engine.start)
     {
         Engine.start = true;
         canvas.Update();
     }
     else
     {
         MouseCoords[0] = (int)Math.Floor((e.Y - canvas.Y) / 16f);
         MouseCoords[1] = (int)Math.Floor((e.X - canvas.X) / 16f);
         setMouseArea();
         form.Refresh();
         if (waitState == 2)
         {
             if (MA == MouseArea.World || MA == MouseArea.Console || MA == MouseArea.Sidebar)
             {
                 waitState = -1;
             }
             else if (MA != LastMA || MA == Exception)
             {
                 waitState = 0;
             }
         }
         else if (waitState == 3)
         {
             if (MA == MouseArea.World || MA == MouseArea.Console || MA == MouseArea.Sidebar)
             {
                 waitState = -1;
             }
             else if (MA == MouseArea.Grid)
             {
                 waitState = 0;
             }
         }
         else if (player.HandleMouseInput(e))
         {
             PlayerInvClickCoords = new int[] { -1, -1 };
             TileInvClickCoords   = new int[] { -1, -1 };
             MouseCoords          = new int[] { -1, -1 };
             GridClickCoords      = new int[] { -1, -1 };
             Program.MA           = MouseArea.Hidden;
             GameLoop();
         }
         else
         {
             form.Refresh();
         }
     }
 }
コード例 #12
0
ファイル: Place.cs プロジェクト: FeedFestival/LG
    public Place(int x, int y, MouseArea mA, Board.DrawUnitCallback drawUnitCallback)
    {
        _x = x; _y = y;

        mouseArea = mA;
        mouseArea.Init(_x, _y, OnMouseOverCallback, OnMouseExitCallback, OnMouseDownCallback);

        mouseArea.gameObject.name = "plc[" + x + ", " + y + "]";

        _drawUnitCallback = drawUnitCallback;

        MeshRenderer meshRenderer = mouseArea.gameObject.GetComponent <MeshRenderer>();

        Material = meshRenderer.material;
        ChangeState(PlaceState.Idle);
    }
コード例 #13
0
        private void HandleMouseEvent(int button, ScreenPoint scaledScreen)
        {
            PicturePoint pt = this.GraphicsDriver.ScreenToPicturePoint(scaledScreen);

            switch (this.MouseMode)
            {
            case MouseMode.Brian:
                this.PushMouseStack(button, pt.X, pt.Y);
                break;

            case MouseMode.SierraV2:
            {
                int x = pt.X;
                int y = pt.Y;

                MouseArea area = this.CheckArea(ref x, ref y);

                switch (area)
                {
                case MouseArea.Status:
                    // Note we don't check for Flags.Menu, so the mouse
                    // can trigger the menu even if it can't be done with keyboard
                    // Because we don't check Flags.Menu, we have to check for empty menu
                    if (this.State.MenuEnabled && this.Interpreter.Menu.Items.Count > 0)
                    {
                        this.ShowMenu();
                    }

                    break;

                case MouseArea.Game:
                    this.ObjectManager.MoveEgo(x, y);
                    break;

                case MouseArea.CommandEntry:
                    this.ObjectManager.MoveEgo(x, 169);
                    break;
                }
            }

            break;

            case MouseMode.SierraV3:
                break;
            }
        }
コード例 #14
0
 /// <summary>
 /// 测距操作
 /// </summary>
 /// <param name="mc"></param>
 public DistanceOperation(MouseArea mc)
 {
     this.reversePath      = new GraphicsPath();
     this.graph            = null;
     this.points           = new ArrayList();
     this.moveindex        = -1;
     this.startpoint       = PointF.Empty;
     this.prePoint         = PointF.Empty;
     this.nextPoint        = PointF.Empty;
     this.insertindex      = -1;
     this.tooltips         = new Hashtable(0x10);
     this.oldpoints        = string.Empty;
     this.mousedown        = false;
     this.mouseAreaControl = mc;
     this.win32            = mc.win32;
     this.mouseAreaControl.DefaultCursor = SpecialCursors.MeasureCursor;
     this.tempPath     = new GraphicsPath();
     this.connectPoint = PointF.Empty;
 }
コード例 #15
0
ファイル: PolyOperation.cs プロジェクト: github188/myitoppsp
 // Methods
 public PolyOperation(MouseArea mc)
 {
     this.mouseAreaControl = null;
     this.win32            = null;
     this.reversePath      = new GraphicsPath();
     this.graph            = null;
     this.operate          = PolyOperate.Draw;
     this.points           = new PointF[0];
     this.moveindex        = -1;
     this.startpoint       = PointF.Empty;
     this.prePoint         = PointF.Empty;
     this.nextPoint        = PointF.Empty;
     this.insertindex      = -1;
     this.tooltips         = new Hashtable(0x10);
     this.oldpoints        = string.Empty;
     this.mousedown        = false;
     this.AreaPoints       = new ArrayList();
     this.mouseAreaControl = mc;
     this.win32            = mc.win32;
     this.mouseAreaControl.PicturePanel.GraphChanged += new EventHandler(this.ChangeGraph);
     this.mouseAreaControl.SVGDocument.SelectCollection.OnCollectionChangedEvent += new OnCollectionChangedEventHandler(this.ChangeSelect);
     this.mouseAreaControl.DefaultCursor = SpecialCursors.bezierCursor;
 }
コード例 #16
0
 // Methods
 internal SubOperation(MouseArea mc)
 {
     this.currentGraph     = null;
     this.mouseAreaControl = null;
     this.mouseAreaControl = mc;
 }
コード例 #17
0
ファイル: Program.cs プロジェクト: benjamin-allen/GridRL
        private static void setMouseArea(bool isHovering = false)
        {
            int y = MouseCoords[0];
            int x = MouseCoords[1];

            if (x < 65 && x >= 0)
            {
                if (y < 41 && y >= 0)
                {
                    MA = MouseArea.World;
                }
                else if (y >= 41 && y <= 44)
                {
                    MA = MouseArea.Console;
                }
                else
                {
                    MA = MouseArea.Hidden;
                }
            }
            else if (x >= sidebar.CellsX && x < sidebar.CellsX + 11)
            {
                if (x == 74)
                {
                    if (y == 18)
                    {
                        MA = MouseArea.HoldBox;
                    }
                    else if (y == 20)
                    {
                        MA = MouseArea.WearBox;
                    }
                    else if (y == 22)
                    {
                        MA = MouseArea.WieldBox;
                    }
                }
                else
                {
                    MA = MouseArea.Sidebar;
                }
                if (y >= sidebar.CellsY && y < sidebar.CellsY + 2)
                {
                    MA = MouseArea.PlayerInv;
                    if (isHovering)
                    {
                        PlayerInvHoverCoords[0] = y - sidebar.CellsY;
                        PlayerInvHoverCoords[1] = x - sidebar.CellsX;
                    }
                    else
                    {
                        PlayerInvClickCoords[0] = y - sidebar.CellsY;
                        PlayerInvClickCoords[1] = x - sidebar.CellsX;
                    }
                }
                else if (y >= sidebar.CellsY2 && y < sidebar.CellsY2 + 2)
                {
                    MA = MouseArea.TileInv;
                    if (isHovering)
                    {
                        TileInvHoverCoords[0] = y - sidebar.CellsY2;
                        TileInvHoverCoords[1] = x - sidebar.CellsX;
                    }
                    else
                    {
                        TileInvClickCoords[0] = y - sidebar.CellsY2;
                        TileInvClickCoords[1] = x - sidebar.CellsX;
                    }
                }
                else if (x >= sidebar.GridX && x < sidebar.GridX + 9 && y >= sidebar.GridY && y < sidebar.GridY + 9)
                {
                    MA = MouseArea.Grid;
                    if (isHovering)
                    {
                        GridHoverCoords[0] = (y - sidebar.GridY) / 3;
                        GridHoverCoords[1] = (x - sidebar.GridX) / 3;
                    }
                    else
                    {
                        GridClickCoords[0] = (y - sidebar.GridY) / 3;
                        GridClickCoords[1] = (x - sidebar.GridX) / 3;
                    }
                }
            }
            else
            {
                MA = MouseArea.Sidebar;
            }
        }
コード例 #18
0
ファイル: FlipOperation.cs プロジェクト: github188/myitoppsp
 // Methods
 public FlipOperation(MouseArea mc)
 {
     this.mouseAreaControl = null;
     this.mouseAreaControl = mc;
     this.win32            = mc.win32;
 }
コード例 #19
0
ファイル: ViewOperation.cs プロジェクト: github188/myitoppsp
 internal ViewOperation(MouseArea mousearea) : this()
 {
     this.mouseAreaControl = mousearea;
     this.win32            = mousearea.win32;
 }
コード例 #20
0
ファイル: StructureTiles.cs プロジェクト: Holomanga/AFungus
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     mouseArea  = GetNode <MouseArea>("MouseArea");
     tilePlacer = GetParent <Level>().GetNode <Mushrum>("Mushrum");
 }
コード例 #21
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            _CurrentTime += _Timer.Interval.Milliseconds;

            if (null == ViewModel)
            {
                return;
            }

            if (NodeGraphManager.IsDragging)
            {
                MouseArea area = CheckMouseArea();

                if (MouseArea.None != area)
                {
                    Point delta = new Point(0.0, 0.0);
                    if (MouseArea.Left == (area & MouseArea.Left))
                    {
                        delta.X = -10.0;
                    }
                    if (MouseArea.Right == (area & MouseArea.Right))
                    {
                        delta.X = 10.0;
                    }
                    if (MouseArea.Top == (area & MouseArea.Top))
                    {
                        delta.Y = -10.0;
                    }
                    if (MouseArea.Bottom == (area & MouseArea.Bottom))
                    {
                        delta.Y = 10.0;
                    }

                    Point mousePos = Mouse.GetPosition(this);
                    UpdateDragging(
                        new Point(mousePos.X + delta.X, mousePos.Y + delta.Y), // virtual mouse-position.
                        delta);                                                // virtual delta.

                    _ZoomAndPan.StartX += delta.X;
                    _ZoomAndPan.StartY += delta.Y;
                }
            }
            else if (_IsWheeling)
            {
                if (200 < (_CurrentTime - _WheelStartTime))
                {
                    _IsWheeling = false;

                    History.NodeGraphHistory history = ViewModel.Model.History;

                    history.AddCommand(new History.ZoomAndPanCommand(
                                           "ZoomAndPan", ViewModel.Model, _ZoomAndPanStartMatrix, ZoomAndPan.Matrix));

                    history.EndTransaction(false);
                }
            }
            else
            {
                _CurrentTime = 0.0;
            }
        }