コード例 #1
0
ファイル: mapView.cs プロジェクト: salviati/verge3
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (!live || ParentMap.IsBrush)
            {
                return;
            }

            mdown = false;

            if (bDragging)
            {
                Cursor    = Cursors.Default;
                Capture   = false;
                bDragging = false;

                if (bSliding)
                {
                    bSliding           = bSlidingLeft = bSlidingRight = bSlidingDown = bSlidingUp = false;
                    slideTimer.Enabled = false;
                }
            }

            if (bDraggingTool)
            {
                setupMapCursorLocation(ref currMapEventInfo.end, e.X, e.Y);
                currMapDragTool.MouseUp(currMapEventInfo);
                bDraggingTool = false;

                if (currMapEventInfo.bDirty)
                {
                    Invalidate();
                }
                currMapEventInfo.bDirty = false;
            }

            ParentMap.bUpdating = false;

            currMapPlugin   = null;
            currMapTool     = null;
            currMapDragTool = null;
        }
コード例 #2
0
ファイル: mapView.cs プロジェクト: jder/verge3
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (!live || ParentMap.IsBrush)
                return;

            mdown = false;

            if (bDragging) {
                Cursor = Cursors.Default;
                Capture = false;
                bDragging = false;

                if (bSliding) {
                    bSliding = bSlidingLeft = bSlidingRight = bSlidingDown = bSlidingUp = false;
                    slideTimer.Enabled = false;
                }
            }

            if (bDraggingTool) {
                setupMapCursorLocation(ref currMapEventInfo.end, e.X, e.Y);
                currMapDragTool.MouseUp(currMapEventInfo);
                bDraggingTool = false;

                if (currMapEventInfo.bDirty)
                    Invalidate();
                currMapEventInfo.bDirty = false;
            }

            ParentMap.bUpdating = false;

            currMapPlugin = null;
            currMapTool = null;
            currMapDragTool = null;
        }
コード例 #3
0
ファイル: mapView.cs プロジェクト: jder/verge3
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (!live || ParentMap.IsBrush)
                return;

            mdown = true;
            if (Global.editedLayer.type == LayerType.Entity) {

                if (Global.SelectedEntity != null) {
                    Global.SelectedEntity.TileX = Global.MapCursorLocation.X;
                    Global.SelectedEntity.TileY = Global.MapCursorLocation.Y;
                }
                return;
            }

            currMapPlugin = Global.toolPalette.currMapPlugin;
            if (currMapPlugin == null)
                return;

            //get the tool to be used
            currMapTool = currMapPlugin.getTool(
                    e.Button == MouseButtons.Left,
                    e.Button == MouseButtons.Right,
                    ((Control.ModifierKeys & Keys.Shift) != 0),
                    ((Control.ModifierKeys & Keys.Control) != 0),
                    ((Control.ModifierKeys & Keys.Alt) != 0)
                    );
            if (currMapTool == null)
                return;

            //ensure that the tool to be used works with the current edited layer
            MapLayer ml = null;

            foreach (LayerType t in currMapTool.layerTypes) {
                if (t == Global.editedLayer.type)
                    ml = Global.editedLayer;
            }

            if (ml == null) {
                currMapTool = null;
                return;
            }

            Capture = true;
            bDragging = true;
            ParentMap.bUpdating = true;

            //setup eventinfo
            currMapEventInfo = new Plugins.MapEventInfo();
            //currMapEventInfo.invalidateEvent += new EventHandler(invalidateEvent);

            currMapEventInfo.editedMap = ParentMap;
            currMapEventInfo.editedLayer = ml;
            currMapEventInfo.editedLayerIndex = ParentMap.Layers.IndexOf(ml);
            currMapEventInfo.lb = ((e.Button & MouseButtons.Left) > 0);
            currMapEventInfo.rb = ((e.Button & MouseButtons.Right) > 0);
            currMapEventInfo.opManager = Global.opManager;
            setupMapCursorLocation(ref currMapEventInfo.start, e.X, e.Y);
            setupMapCursorLocation(ref currMapEventInfo.current, e.X, e.Y);
            setupMapCursorLocation(ref currMapEventInfo.previous, e.X, e.Y);
            currMapEventInfo.bDirty = false;
            if (currMapTool is Plugins.IMapDragTool) {
                bDraggingTool = true;
                currMapDragTool = (Plugins.IMapDragTool)currMapTool;
                currMapDragTool.MouseDown(currMapEventInfo);
                currMapDragTool.MouseMove(currMapEventInfo);
                if (currMapDragTool is Plugins.IMapDragTileTool)
                    ((Plugins.IMapDragTileTool)currMapDragTool).MouseMoveTile(currMapEventInfo);
            }
            if (currMapTool is Plugins.IMapClickTool) {
                ((Plugins.IMapClickTool)currMapTool).MouseClick(currMapEventInfo);
            }
            if (currMapEventInfo.bDirty)
                Invalidate();
            currMapEventInfo.bDirty = false;
        }
コード例 #4
0
ファイル: mapView.cs プロジェクト: salviati/verge3
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (!live || ParentMap.IsBrush)
            {
                return;
            }


            mdown = true;
            if (Global.editedLayer.type == LayerType.Entity)
            {
                if (Global.SelectedEntity != null)
                {
                    Global.SelectedEntity.TileX = Global.MapCursorLocation.X;
                    Global.SelectedEntity.TileY = Global.MapCursorLocation.Y;
                }
                return;
            }

            currMapPlugin = Global.toolPalette.currMapPlugin;
            if (currMapPlugin == null)
            {
                return;
            }


            //get the tool to be used
            currMapTool = currMapPlugin.getTool(
                e.Button == MouseButtons.Left,
                e.Button == MouseButtons.Right,
                ((Control.ModifierKeys & Keys.Shift) != 0),
                ((Control.ModifierKeys & Keys.Control) != 0),
                ((Control.ModifierKeys & Keys.Alt) != 0)
                );
            if (currMapTool == null)
            {
                return;
            }

            //ensure that the tool to be used works with the current edited layer
            MapLayer ml = null;

            foreach (LayerType t in currMapTool.layerTypes)
            {
                if (t == Global.editedLayer.type)
                {
                    ml = Global.editedLayer;
                }
            }

            if (ml == null)
            {
                currMapTool = null;
                return;
            }

            Capture             = true;
            bDragging           = true;
            ParentMap.bUpdating = true;


            //setup eventinfo
            currMapEventInfo = new Plugins.MapEventInfo();
            //currMapEventInfo.invalidateEvent += new EventHandler(invalidateEvent);

            currMapEventInfo.editedMap        = ParentMap;
            currMapEventInfo.editedLayer      = ml;
            currMapEventInfo.editedLayerIndex = ParentMap.Layers.IndexOf(ml);
            currMapEventInfo.lb        = ((e.Button & MouseButtons.Left) > 0);
            currMapEventInfo.rb        = ((e.Button & MouseButtons.Right) > 0);
            currMapEventInfo.opManager = Global.opManager;
            setupMapCursorLocation(ref currMapEventInfo.start, e.X, e.Y);
            setupMapCursorLocation(ref currMapEventInfo.current, e.X, e.Y);
            setupMapCursorLocation(ref currMapEventInfo.previous, e.X, e.Y);
            currMapEventInfo.bDirty = false;
            if (currMapTool is Plugins.IMapDragTool)
            {
                bDraggingTool   = true;
                currMapDragTool = (Plugins.IMapDragTool)currMapTool;
                currMapDragTool.MouseDown(currMapEventInfo);
                currMapDragTool.MouseMove(currMapEventInfo);
                if (currMapDragTool is Plugins.IMapDragTileTool)
                {
                    ((Plugins.IMapDragTileTool)currMapDragTool).MouseMoveTile(currMapEventInfo);
                }
            }
            if (currMapTool is Plugins.IMapClickTool)
            {
                ((Plugins.IMapClickTool)currMapTool).MouseClick(currMapEventInfo);
            }
            if (currMapEventInfo.bDirty)
            {
                Invalidate();
            }
            currMapEventInfo.bDirty = false;
        }