public override void OnDrawEnd(PADrawEvent evt, bool cancelled) { base.OnDrawEnd(evt, cancelled); if (Selection != null) { var textureRect = Canvas.ImageToTexture(Selection.Value); if (evt.shift && evt.alt) { Canvas.SelectionMask.FillRect(textureRect, Color.clear); } else { if (!evt.shift) { Canvas.SelectionMask.Clear(Color.clear); } Canvas.SelectionMask.FillRect(textureRect, Color.white); } Canvas.ApplySelectionMask(); Selection = null; } else { Canvas.ClearSelection(); } MarkDirtyRepaint(); }
public override void OnDrawStart(PADrawEvent evt) { // TODO: if the cursor is over the selection area then start moving the pixels _pivot = Canvas.ClampImagePosition(evt.imagePosition); MarkDirtyRepaint(); }
public override void OnDrawContinue(PADrawEvent evt) { var drawPosition = Canvas.ClampImagePosition(evt.imagePosition); var min = Vector2Int.Min(_pivot, drawPosition); var max = Vector2Int.Max(_pivot, drawPosition); Selection = new RectInt(min, max - min + Vector2Int.one); MarkDirtyRepaint(); }
public override void OnDrawStart(PADrawEvent evt) { if (!evt.shift || _drawPosition == null) { _drawPosition = CanvasToTexture(evt.imagePosition); } _drawColor = GetDrawColor(evt.button); _target = Canvas.File.AddImage(Canvas.ActiveFrame, Canvas.ActiveLayer); DrawTo(evt.imagePosition); }
public override void OnDrawContinue(PADrawEvent evt) => SampleColor(evt.button, evt.imagePosition);
public override void OnDrawContinue(PADrawEvent evt) { Canvas.Workspace.ViewportOffset = _scrollStart - (Canvas.Workspace.CanvasToViewport(evt.canvasPosition) - _mouseStart); }
public override void OnDrawStart(PADrawEvent evt) { _mouseStart = Canvas.Workspace.CanvasToViewport(evt.canvasPosition); _scrollStart = Canvas.Workspace.ViewportOffset; }
public override void OnDrawEnd(PADrawEvent evt, bool cancelled) { _target = null; Canvas.RefreshImage(); }
public override void OnDrawContinue(PADrawEvent evt) => DrawTo(evt.imagePosition);
public virtual void OnDrawEnd(PADrawEvent evt, bool cancelled) { }
public virtual void OnDrawContinue(PADrawEvent evt) { }
public virtual void OnDrawStart(PADrawEvent evt) { }