protected override void OnUIDragBegin(object sender, PaintDotNet.UI.Input.MouseEventArgs e) { if (e.Source is UIElement) { bool flag = (base.PresentationSource.PrimaryKeyboardDevice.Modifiers & ModifierKeys.Control) == ModifierKeys.Control; PointDouble mouseCenterPt = BrushToolBase <CloneStampTool, CloneStampToolChanges, CloneStampToolUI> .GetMouseCenterPt(e.GetPosition(base.UI), base.CanvasView.CanvasHairWidth); if (flag) { this.isHandlingDrag = true; this.GetStaticData().anchorOffsetMode = AnchorOffsetMode.Absolute; this.GetStaticData().anchorOffset = (VectorDouble)mouseCenterPt; this.GetStaticData().anchorLayerWeak = new WeakReferenceT <Layer>(base.ActiveLayer); this.UpdateAnchor(); e.Handled = true; } else if (this.GetStaticData().anchorOffsetMode == AnchorOffsetMode.NotSet) { this.isHandlingDrag = true; e.Handled = true; } else if (this.GetStaticData().anchorOffsetMode == AnchorOffsetMode.Absolute) { PointDouble anchorCenter = this.GetStaticData().anchorCenter; this.GetStaticData().anchorOffsetMode = AnchorOffsetMode.Relative; VectorDouble num4 = (VectorDouble)(((PointDouble)this.GetStaticData().anchorOffset) - mouseCenterPt); this.GetStaticData().anchorOffset = num4; this.UpdateAnchor(); PointDouble num5 = this.GetStaticData().anchorCenter; } } base.OnUIDragBegin(sender, e); }
protected override void OnUIDragMove(object sender, PaintDotNet.UI.Input.MouseEventArgs e) { if (this.isHandlingDrag && (e.Source is UIElement)) { PointDouble mouseCenterPt = BrushToolBase <CloneStampTool, CloneStampToolChanges, CloneStampToolUI> .GetMouseCenterPt(e.GetPosition(base.UI), base.CanvasView.CanvasHairWidth); if (this.GetStaticData().anchorOffsetMode == AnchorOffsetMode.Absolute) { this.GetStaticData().anchorOffset = (VectorDouble)mouseCenterPt; this.UpdateAnchor(); } e.Handled = true; } this.UpdateAnchor(); base.OnUIDragMove(sender, e); }
protected override void OnUIDragEnd(object sender, PaintDotNet.UI.Input.MouseEventArgs e) { if (this.isHandlingDrag) { if (e.Source is UIElement) { PointDouble mouseCenterPt = BrushToolBase <CloneStampTool, CloneStampToolChanges, CloneStampToolUI> .GetMouseCenterPt(e.GetPosition(base.UI), base.CanvasView.CanvasHairWidth); if (this.GetStaticData().anchorOffsetMode == AnchorOffsetMode.Absolute) { this.GetStaticData().anchorOffset = (VectorDouble)mouseCenterPt; this.UpdateAnchor(); } else if (this.GetStaticData().anchorOffsetMode == AnchorOffsetMode.NotSet) { string message = PdnResources.GetString("CloneStampTool.Error.TriedToDrawWithoutAnchor.Text"); MessageBoxUtil.ErrorBox(base.DocumentWorkspace, message); } } e.Handled = true; this.isHandlingDrag = false; } base.OnUIDragEnd(sender, e); }