internal override void OnCursor(MapViewCursorVM cursor) { if ((cursor.Action == CursorActions.Move || cursor.Action == CursorActions.Down) && cursor.Buttons.HasFlag(CursorButtons.Left)) { SetValue(cursor.WorldIndexCoords, ActionsSelector.SelectedIndex); } }
public MapEditorViewVM(MapEditorVM parent, ViewRenderer renderer, RenderTarget renderTarget) { Parent = parent; this.renderer = renderer; RenderTarget = renderTarget; Transformation = new Matrix(); Cursor = new MapViewCursorVM(Parent); Cursor.ToWorldCoordsFunc = ToWorldCoords; Cursor.PropertyChanged += Cursor_PropertyChanged; }
internal override void OnCursor(MapViewCursorVM cursor) { switch (cursor.Action) { case CursorActions.Hover: break; case CursorActions.Leave: break; case CursorActions.Move: UpdateInsertion(); UpdateInserting(); break; case CursorActions.Click: break; case CursorActions.Up: if (Mode == InsertModeEnum.Nothing) { return; } if (cursor.Buttons.HasFlag(CursorButtons.Left)) { FinishInserting(); } break; case CursorActions.Down: if (Mode != InsertModeEnum.Nothing) { return; } if (cursor.Buttons.HasFlag(CursorButtons.Left)) { StartInserting(InsertModeEnum.Point); } break; default: break; } }
//public virtual void DrawSelection(Graphics gfx) //{ // Pen selectedPen = new Pen(Color.LightGreen); // Pen selectPen = new Pen(Color.LightBlue); // Pen deselectPen = new Pen(Color.Red); // for (int index = 0; index < SelectedIndexes.Count; index++) // { // Rectangle rectangle = CurrentTileSet.Items[SelectedIndexes[index]].Rectangle; // gfx.DrawRectangle(selectedPen, rectangle); // } // if (SelectMode == SelectModeEnum.Select) // gfx.DrawRectangle(selectPen, SelectionRectangle.GetRectangle(CurrentTileSet.TileSize)); // else if (SelectMode == SelectModeEnum.Deselect) // gfx.DrawRectangle(deselectPen, SelectionRectangle.GetRectangle(CurrentTileSet.TileSize)); //} internal virtual void OnCursor(MapViewCursorVM cursor) { }
internal void OnCursorUpdate(MapViewCursorVM cursor) { CurrentTool.OnCursor(cursor); }