static void Init() { CircleTool window = (CircleTool)EditorWindow.GetWindow(typeof(CircleTool)); window.Show(); GetWindow <CircleTool>("CircleTool"); }
/// <summary> /// 注册所有工具的相应部分上下文 /// </summary> private void Init() { _cursor = new Dictionary <string, Cursor>(); _cursor["Tool_Drag"] = Cursors.Arrow; _cursor["Tool_Rectangle"] = Cursors.Cross; _cursor["Tool_Triangle"] = Cursors.Cross; _cursor["Tool_Image"] = Cursors.Cross; _cursor["Tool_QRCode"] = Cursors.Cross; _cursor["Tool_Circle"] = Cursors.Cross; _cursor["Tool_Text"] = Cursors.IBeam; _cursor["Tool_Line"] = Cursors.Cross; _toolType = new Dictionary <string, ToolType>(); _toolType["Tool_Drag"] = ToolType.Drag; _toolType["Tool_Rectangle"] = ToolType.Rectangle; _toolType["Tool_Triangle"] = ToolType.Triangle; _toolType["Tool_Image"] = ToolType.Image; _toolType["Tool_QRCode"] = ToolType.QRCode; _toolType["Tool_Circle"] = ToolType.Circle; _toolType["Tool_Text"] = ToolType.Text; _toolType["Tool_Line"] = ToolType.Line; _paintTool = new Dictionary <string, PaintToolBase>(); _paintTool["Tool_Line"] = new LineTool(); _paintTool["Tool_Drag"] = new DragTool(); _paintTool["Tool_Triangle"] = new TriangleTool(); _paintTool["Tool_Circle"] = new CircleTool(); _paintTool["Tool_Rectangle"] = new RectangleTool(); _paintTool["Tool_Image"] = new ImageTool(); _paintTool["Tool_Text"] = new TextTool(); }
public override void Draw(Layer layer, int toolSize, Coordinates coordinates, SKPaint paint) { int halfSize = (int)Math.Ceiling(toolSize / 2f); int modifier = toolSize % 2 != 0 ? 1 : 0; Coordinates topLeft = new Coordinates(coordinates.X - halfSize + modifier, coordinates.Y - halfSize + modifier); Coordinates bottomRight = new Coordinates(coordinates.X + halfSize - 1, coordinates.Y + halfSize - 1); CircleTool.DrawEllipseFromCoordinates(layer, topLeft, bottomRight, paint.Color, paint.Color, 1, true); }
private ToolManager() { AssignmentTool = new AssignmentTool(); CircleTool = new CircleTool(); ConditionTool = new ConditionTool(); InitializeTool = new InitializeTool(); InvokeTool = new InvokeTool(); ReturnTool = new ReturnTool(); SecurityTool = new SecurityTool(); }
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); }
private void OnSceneGUI() { CircleTool tool = (CircleTool)target; lineRend = tool.GetLineRender(); if (lineRend) { EditorGUI.BeginChangeCheck(); tool.t = Handles.ScaleHandle(tool.t, tool.transform.position, Quaternion.identity, 2f); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Adjusted Circle"); } CreatePoints(tool.t.x, Mathf.RoundToInt(tool.t.y)); } }
private void CirlceButtonClick(object sender, EventArgs e) { outputPanel.Add(CircleTool.Build()); listView1.Items.Add(new ListViewItem("Circle")); Invalidate(true); }