public bool hitStatus; // If we actully hit anything // Use this for initialization void Start () { toolList = new Hashtable(); toolList.Add("select", new SelecterTool()); toolList.Add("build", new BuilderTool()); currentToolName = "select"; currentTool = toolList[currentToolName] as PointerTool; viewDistance = activeCamera.farClipPlane - activeCamera.nearClipPlane; }
// TODO: MultiTileGridLayer stuff should move into appropriate class public void SetTool(TileTool tool) { if (LayerContext == null) { return; } if (_selection != null && tool == TileTool.Select) { _selection.Activate(); } else if (_selection != null) { _selection.Deactivate(); } if (_currentTool != null) { _currentTool.Dispose(); } switch (tool) { case TileTool.Select: _currentTool = new TileSelectTool(LayerContext.History, Layer as MultiTileGridLayer, LayerContext.Annotations, this); break; case TileTool.Draw: TileDrawTool drawTool = new TileDrawTool(LayerContext.History, Layer as MultiTileGridLayer, LayerContext.Annotations); drawTool.Info = Info; drawTool.BindTilePoolController(_tilePoolController); drawTool.BindTileBrushManager(_tileBrushController); _currentTool = drawTool; break; case TileTool.Erase: _currentTool = new TileEraseTool(LayerContext.History, Layer as MultiTileGridLayer, LayerContext.Annotations); break; case TileTool.Fill: TileFillTool fillTool = new TileFillTool(LayerContext.History, Layer as MultiTileGridLayer, _sourceType); fillTool.BindTilePoolController(_tilePoolController); fillTool.BindTileBrushManager(_tileBrushController); _currentTool = fillTool; break; default: _currentTool = null; break; } }
public DrawTools(MainWin window, PictureBox pic) { this.mainWindow = window; this.mainPicture = pic; this.pointerTool = new PointerTool(mainWindow, mainPicture); this.lineTool = new LineTool(mainWindow, mainPicture); this.rectTool = new RectTool(mainWindow, mainPicture); this.polyTool = new PolyTool(mainWindow, mainPicture); this.circleTool = new CircleTool(mainWindow, mainPicture); this.curveTool = new CurveTool(mainWindow, mainPicture); this.fillTool = new FillTool(mainWindow, mainPicture); this.resizeTool = new ResizeTool(mainWindow, mainPicture); this.cutTool = new CutTool(mainWindow, mainPicture); }
public bool ChangeTool(string toolName) { // Check if the tool exists if(toolList.ContainsKey(toolName)) { Debug.Log("Tool exists, switching to tool " + toolName); currentTool.Deactivate(); currentToolName = toolName; currentTool = toolList[currentToolName] as PointerTool; currentTool.Activate(); return true; } else { Debug.Log(toolName + " does not exist"); return false; } }
private void SetCurrentTool(PointerTool tool) { ObjectSelectTool objTool = _currentTool as ObjectSelectTool; if (objTool != null) { objTool.Cancel(); _selectionManager.ClearSelection(); _commandManager.RemoveCommandSubscriber(objTool); } _currentTool = tool; objTool = _currentTool as ObjectSelectTool; if (objTool != null && objTool.CommandManager != null) { _commandManager.AddCommandSubscriber(objTool); } }
public Viewport() { InitializeComponent(); SetStyle(ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true); Zoom = 1; MaxZoom = double.MaxValue; MinZoom = 0; ZoomFactor = 2f; Angle = 0; DebugDrawAxies = true; DebugDrawGrid = true; LeftButtonTool = new PointerTool(); MiddleButtonTool = new PanTool(); RightButtonTool = new RotateViewTool(); WheelScrollTool = new ZoomTool(); _view = new Matrix(); _view.Translate(0, -ClientSize.Height); _view.Scale(1, -1); }