// Selects the ammount of damage a click does to a tile void UpdateToolSelection(SelectedTool tool) { currentTool = tool; switch (currentTool) { case SelectedTool.HAMMER: toolStrength = 4; break; case SelectedTool.PICKAXE: toolStrength = 3; break; case SelectedTool.TROWEL: toolStrength = 2; break; case SelectedTool.NONE: toolStrength = 0; break; default: break; } }
public void Update(GameTime gametime) { if (HasToolSelected) { SelectedTool.Update(gametime); } }
void RemoveTool(IList <Rectangle> updates) { if (SelectedTool != null) { SelectedTool.RemoveDrawing(updates); } }
private void handleMouseUp(MouseEventArgs param) { if (param == null) { throw new InvalidOperationException(GetFunctionName()); } var sender = param.Source as IInputElement; if (sender == null) { throw new InvalidOperationException(GetFunctionName()); } bool isScreenDirty = false; // Ist die Kamera Bewegung aktiviert? if ((Keyboard.Modifiers & ModifierKeys.Alt) > 0) { _camera.OnMouseUp(param, ref isScreenDirty); } else { SelectedTool.OnMouseUp(param, ref isScreenDirty); //_tool.OnMouseUp(param); } Mouse.OverrideCursor = null; if (isScreenDirty) { _dxElement.Render(); } }
internal override void UIUpdate() { try { base.UIUpdate(); flyCam.Update(); if (toolLineProperty.visible) { toolLineProperty.UIUpdate(); } if (toolSetting.visible) { toolSetting.UIUpdate(); } if (SelectedTool.isShapeTool()) { toolShape.Update(); } if (SelectedTool == ToolType.Image) { toolImage.UIUpdate(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }
public void SelectTool(ITool tool) { ITool oldTool = null; ITool newTool = null; if (tool.IsActivatable) { if (ActivatedTools.Contains(tool)) { ActivatedTools.Remove(tool); } else { ActivatedTools.Add(tool); } tool.IsActivated = ActivatedTools.Contains(tool); } else { oldTool = SelectedTool; SelectedTool?.Unselect(); SelectedTool = tool; SelectedTool.Select(); newTool = SelectedTool; } ToolSelected?.Invoke(this, new ToolSelectedEventArgs(oldTool, newTool)); }
public override void OnKeyDown(KeyEventArgs e) { var allowToolSelection = true; if (SelectedTool != null) { SelectedTool.OnKeyDown(e); allowToolSelection = SelectedTool.AllowToolShortcuts; } if (!e.Handled && allowToolSelection) { foreach (var tool in Tools) { if (e.KeyData == tool.Accelerator && tool != SelectedTool) { SelectedTool = tool; e.Handled = true; break; } } } if (!e.Handled) { base.OnKeyDown(e); } }
public void UndoInternal(bool IncludeSelectionOperation = false) { if (undoStack.Count == 0) { return; } PostFilter undoFilter; do { undoFilter = undoStack.Pop(); redoStack.Push(undoFilter); undoFilter.Undo(); } while ((!IncludeSelectionOperation && (undoFilter is SelectionOperation)) && (undoStack.Count != 0)); if (!(undoFilter is EditingActivatedOperation || undoFilter is SelectionOperation || undoFilter is SetColorOperation)) { ClearCanvas(false); RecreateCanvasViewModel(); UpdateUIElements(); DisplaySettingsTool.SliceImage(); if (undoStack.Count == 0) { UnsavedChanges = false; } } else { UpdateUIElements(); } SelectedTool.OnUndo(); }
public void RedoInternal(bool IncludeSelectionOperation = false) { if (redoStack.Count == 0) { return; } PostFilter redoFilter; do { redoFilter = redoStack.Pop(); undoStack.Push(redoFilter); redoFilter.Apply(); } while ((!IncludeSelectionOperation && redoFilter is SelectionOperation) && redoStack.Count != 0); if (!(redoFilter is EditingDeactivatedOperation || redoFilter is SelectionOperation || redoFilter is SetColorOperation)) { ClearCanvas(false); RecreateCanvasViewModel(); UpdateUIElements(); DisplaySettingsTool.SliceImage(); } else { UpdateUIElements(); } SelectedTool.OnRedo(); }
private void handleMouseDown(MouseEventArgs param) { _dxElement.Focusable = true; Keyboard.Focus(_dxElement); if (param == null) { throw new InvalidOperationException(GetFunctionName()); } bool isScreenDirty = false; if ((Keyboard.Modifiers & ModifierKeys.Alt) > 0) { _camera.OnMouseDown(param, ref isScreenDirty); } else { SelectedTool.OnMouseDown(param, ref isScreenDirty); } //_tool.OnMouseDown(param); if (isScreenDirty) { // Render _dxElement.Render(); } }
internal override void UIDraw() { try { if (visible || ModContent.GetInstance <TeraCADConfig>().isDrawShpes) { toolShape.DrawShapes(); } if (SelectedTool.isShapeTool()) { toolShape.Draw(); } if (ui.isDisplayRangeRectangle && !InfinityRange) { DrawRangeRectangle(); } if (SelectedTool == ToolType.Image) { toolImage.UIDraw(); } if (toolSetting.visible) { toolSetting.UIDraw(); } if (toolLineProperty.visible) { toolLineProperty.UIDraw(); } base.UIDraw(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }
private void toolsList_SelectionChanged(object sender, SelectionChangedEventArgs e) { additionalSettingsGrid.DataContext = SelectedTool; lineWidthRow.Height = new GridLength(40); strokeColorRow.Height = new GridLength(40); fillColorRow.Height = new GridLength(40); if (SelectedTool is BrushTool || SelectedTool is LineTool) { fillColorRow.Height = new GridLength(0); } else if (SelectedTool is EllipseTool) { roundedCornersRow.Height = new GridLength(0); } else if (SelectedTool is PaintBucketTool) { lineWidthRow.Height = new GridLength(0); strokeColorRow.Height = new GridLength(0); } else if (!SelectedTool.RequiresAdditionalSettings()) { lineWidthRow.Height = new GridLength(0); strokeColorRow.Height = new GridLength(0); fillColorRow.Height = new GridLength(0); } }
public void KeyPress(Gdk.Key key) { if (SelectedTool != null) { SelectedTool.KeyPress(key); } }
public void ManipulationDelta(ManipulationDeltaEventArgs e) { if (SelectedTool != null && !IsWorking) { SelectedTool.Delta(e); } }
void RedrawTool() { if (SelectedTool != null) { SelectedTool.Redraw(); } }
private void rbtnEllipce_CheckedChanged(object sender, EventArgs e) { if (rbtnEllipce.Checked) { _toolType = SelectedTool.Ellipse; ApplyMovedControl(); } }
private void rbtnRect_CheckedChanged(object sender, EventArgs e) { if (rbtnRect.Checked) { _toolType = SelectedTool.Rect; ApplyMovedControl(); } }
void ApplyTool(IList <Rectangle> updates) { if (SelectedTool != null) { SelectedTool.ApplyDrawing(updates); this.BGI.UpdateRegion(updates); } }
public void ManipulationStarted(double imgWidth, double imgHeight, ManipulationStartedEventArgs e) { if (SelectedTool != null && !IsWorking) { SelectedTool.ImageWidth = imgWidth; SelectedTool.ImageHeight = imgHeight; SelectedTool.Started(e); } }
// Change the currently selected tool void SelectTool(SelectedTool tool) { // If no change, nothing to do if (tool == selected_tool) { return; } // If selected tool is not the laser pointer, ensure the laser pointer GameObject is turned off if (tool != SelectedTool.LASER_POINTER) { laserPointer.SetActive(false); laserPointerScript.leftHandGuideline.SetActive(true); laserPointerScript.rightHandGuideline.SetActive(true); } if (tool != SelectedTool.BRUSH) { brush.SetActive(false); } // Log the change in tool Debug.Log(string.Format("Selected Tool {0}", tool)); Vector2 offset = new Vector2(0, 64); if (SelectedTool.HAND == tool) { Cursor.SetCursor(hand_cursor, offset, CursorMode.ForceSoftware); } else if (SelectedTool.BRUSH == tool) { Cursor.SetCursor(brush_cursor, offset, CursorMode.ForceSoftware); brush.SetActive(true); } else if (SelectedTool.FOOD == tool) { Cursor.SetCursor(food_cursor, offset, CursorMode.ForceSoftware); } else if (SelectedTool.LASER_POINTER == tool) { Cursor.SetCursor(laser_cursor, offset, CursorMode.ForceSoftware); // Turn off vive controller laser pointers laserPointerScript.leftHandGuideline.SetActive(false); laserPointerScript.rightHandGuideline.SetActive(false); //Activate laser pointer gameobject laserPointer.SetActive(true); } else if (SelectedTool.LITTER_SCOOPER == tool) { Cursor.SetCursor(litter_cursor, offset, CursorMode.ForceSoftware); } selected_tool = tool; }
public override void OnMouseMove(MouseEventArgs e) { SelectedTool?.OnMouseMove(new MouseEventArgs(e.Buttons, e.Modifiers, e.Location * BGI.Scale, e.Delta, e.Pressure)); if (!e.Handled) { base.OnMouseMove(e); } }
private void mainImage_MouseLeave(object sender, MouseEventArgs e) { if (Drawing) { Drawing = false; SelectedTool.EndDrawing(GetPoint(e)); Draw(); } this.Cursor = Cursors.Arrow; }
public void ManipulationEnded(ManipulationCompletedEventArgs e) { if (SelectedTool != null && !IsWorking) { SelectedTool.Ended(e); CanApply = true; _noChanges = false; UndoCommand.RaiseCanExecuteChanged(); } }
internal void Canvas_MouseMove(Avalonia.Point dominoPoint, PointerEventArgs e) { if (iscopying) { DrawPasteOverlay(dominoPoint, e); } else { SelectedTool?.MouseMove(dominoPoint, e); } }
internal override void KeyPressed(object sender, KeyEventArgs args) { if (iscopying && args.Key == Key.Escape) { FinalizePaste(true); args.Handled = true; } if (!args.Handled) { SelectedTool.KeyPressed(args); } }
public static void SetTool(Tool tool) { if (SelectedTool != null && tool != SelectedTool) { SelectedTool.Stop(); SelectedTool.OnChangingTool(); } if (tool == CurrentTools.HandTool) { _selected = HandTool; HandTool.Stop(); _quickpan = false; } else if (tool == CurrentTools.LineTool) { _selected = LineTool; } else if (tool == CurrentTools.BezierTool) { _selected = BezierTool; } else if (tool == CurrentTools.PencilTool) { _selected = PencilTool; } else if (tool == CurrentTools.EraserTool) { if (SelectedTool == EraserTool) { EraserTool.Swatch.Selected = LineType.All; } _selected = EraserTool; } else if (tool == CurrentTools.MoveTool) { if (SelectedTool == MoveTool) { MoveTool.Swatch.Selected = LineType.All; } _selected = MoveTool; } else if (tool == CurrentTools.SelectTool) { if (SelectedTool == SelectTool) { SelectTool.Swatch.Selected = LineType.All; } _selected = SelectTool; } }
public void SetCursorPosition(Point value, bool invalidate) { if (cursorPosition != value) { Point pos = cursorPosition; cursorPosition = value; cursorPosition.Restrict(new Rectangle(CurrentPage.Canvas.Size)); if (SelectedTool != null) { SelectedTool.OnSetCursorPosition(pos, cursorPosition, invalidate); } OnCursorPositionChanged(EventArgs.Empty); } }
public override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (!AllowEditing) { return; } if (SelectedTool != null) { SelectedTool.OnMouseMove(e); } }
private DrawingColor drawingColorComp; //drawing color //Use this for Initialization void Start() { fontSizeType = FontSizeType.PEN; fontSize = FontSize.MEDIUM; selectedTool = SelectedTool.PEN; lineColor = new Color(0, 147, 68, 100) / 255.0f; prevColor = lineColor; drawingMaterial = GameObject.Find("green (Drawing Level)").GetComponent <DrawingColor> ().drawingMaterial; previousMaterial = drawingMaterial; if (middleCam == null) { middleCam = GameObject.FindGameObjectWithTag("MiddleCam").GetComponent <Camera> (); //setting up middle camera reference } if (drawResizerOb == null) { drawResizerOb = GameObject.Find("Draw-Resizer (Drawing Level)"); } if (toolsAnimator == null) { toolsAnimator = GameObject.Find("Tools").GetComponent <Animator> (); } if (brushObFollowTarget == null) { brushObFollowTarget = GameObject.Find("brush (Drawing Level)").GetComponent <FollowTarget> (); } if (deleteObFollowTarget == null) { deleteObFollowTarget = GameObject.Find("eraser (Drawing Level)").GetComponent <FollowTarget> (); } if (penObFollowTarget == null) { penObFollowTarget = GameObject.Find("pencil (Drawing Level)").GetComponent <FollowTarget> (); } if (colorsWheelControllerComp == null) { colorsWheelControllerComp = GameObject.Find("ColorsWheel (Drawing Level)").GetComponent <ColorsWheelController> (); } drawResizerBackground = drawResizerOb.transform.Find("draw-resizer-background (Drawing Level)").gameObject; SetDrawResizerColor(); SetFontSize(); }
public void CreateImageAtXY(string imageKey, double x, double y) { PixbufRepository.AddOrUpdatePixbufByName(imageKey); var point = new Cairo.PointD(x / Zoom, y / Zoom); var sectionView = getSectionViewByXY(x, y); var localpoint = sectionView.PointInSectionByAbsolutePoint(point); ToolBoxService.SetToolByName("ImageTool"); SelectedTool.CreateNewControl(sectionView); var image = (SelectedControl.ControlModel as Image); image.ImageKey = imageKey; image.Location = new MonoReports.Model.Point(localpoint.X, localpoint.Y); SelectedTool.CreateMode = false; }
private DrawingColor drawingColorComp;//drawing color //Use this for Initialization void Start () { fontSizeType = FontSizeType.PEN; fontSize = FontSize.MEDIUM; selectedTool = SelectedTool.PEN; lineColor = new Color (0, 147, 68, 100) / 255.0f; prevColor = lineColor; drawingMaterial = GameObject.Find ("green (Drawing Level)").GetComponent<DrawingColor> ().drawingMaterial; previousMaterial = drawingMaterial; if (middleCam == null) { middleCam = GameObject.FindGameObjectWithTag ("MiddleCam").GetComponent<Camera> ();//setting up middle camera reference } if (drawResizerOb == null) { drawResizerOb = GameObject.Find ("Draw-Resizer (Drawing Level)"); } if (toolsAnimator == null) { toolsAnimator = GameObject.Find ("Tools").GetComponent<Animator> (); } if (brushObFollowTarget == null) { brushObFollowTarget = GameObject.Find ("brush (Drawing Level)").GetComponent<FollowTarget> (); } if (deleteObFollowTarget == null) { deleteObFollowTarget = GameObject.Find ("eraser (Drawing Level)").GetComponent<FollowTarget> (); } if (penObFollowTarget == null) { penObFollowTarget = GameObject.Find ("pencil (Drawing Level)").GetComponent<FollowTarget> (); } if (colorsWheelControllerComp == null) { colorsWheelControllerComp = GameObject.Find ("ColorsWheel (Drawing Level)").GetComponent<ColorsWheelController> (); } drawResizerBackground = drawResizerOb.transform.Find ("draw-resizer-background (Drawing Level)").gameObject; SetDrawResizerColor (); SetFontSize (); }
//tools events public void ToolsEvents (GameObject toolOb) { if (toolOb == null) { return; } string toolName = toolOb.name; string obTag = toolOb.tag; bool checkSelectedTool = false; bool checkFontSize = false; bool checkPrevColor = false; bool checkDrawResizerColor = false; if (toolName == "small-size-circle (Drawing Level)") { fontSize = FontSize.SMALL; checkFontSize = true; checkDrawResizerColor = true; } else if (toolName == "med-size-circle (Drawing Level)") { fontSize = FontSize.MEDIUM; checkFontSize = true; checkDrawResizerColor = true; } else if (toolName == "larg-size-circle (Drawing Level)") { fontSize = FontSize.LARGE; checkFontSize = true; checkDrawResizerColor = true; } else if (toolName == "trash (Drawing Level)") { ClearBoard (); colorsWheelControllerComp.ScrollingRelease (360, 0); } else if (obTag == "WheelColor") { checkDrawResizerColor = true; checkPrevColor = true; drawingColorComp = toolOb.GetComponent<DrawingColor> (); lineColor = drawingColorComp.color; drawingMaterial = drawingColorComp.drawingMaterial; previousMaterial = drawingMaterial; if (DrawingLevel.isEraserSelected) { checkSelectedTool = true; checkFontSize = true; fontSizeType = FontSizeType.PEN; selectedTool = SelectedTool.PEN; } } else if (toolName == "eraser (Drawing Level)") { DrawingLevel.isEraserSelected = true; selectedTool = SelectedTool.DELETE; checkDrawResizerColor = true; checkSelectedTool = true; lineColor = Color.white; drawingMaterial = DrawingColor.whiteMaterial; } else if (toolName == "pencil (Drawing Level)") { DrawingLevel.isEraserSelected = false; selectedTool = SelectedTool.PEN; checkDrawResizerColor = true; checkSelectedTool = true; checkFontSize = true; fontSizeType = FontSizeType.PEN; lineColor = prevColor; drawingMaterial = previousMaterial; } else if (toolName == "brush (Drawing Level)") { DrawingLevel.isEraserSelected = false; selectedTool = SelectedTool.BRUSH; checkDrawResizerColor = true; checkSelectedTool = true; checkFontSize = true; fontSizeType = FontSizeType.BRUSH; lineColor = prevColor; drawingMaterial = previousMaterial; } if (checkDrawResizerColor) { if (checkPrevColor) { prevColor = lineColor; } SetDrawResizerColor (); } if (checkSelectedTool) { SetSelectedTool (); } if (checkFontSize) { SetFontSize (); } }