|
@@ -19,6 +19,9 @@ namespace PixiEditor.Models.Tools
|
|
|
|
|
|
public bool UseDocumentRectForUndo { get; set; } = false;
|
|
public bool UseDocumentRectForUndo { get; set; } = false;
|
|
|
|
|
|
|
|
+ private SKRectI _rectReportedByTool;
|
|
|
|
+ private bool _customRectReported = false;
|
|
|
|
+
|
|
private StorageBasedChange _change;
|
|
private StorageBasedChange _change;
|
|
|
|
|
|
public abstract void Use(Layer activeLayer, Layer previewLayer, IEnumerable<Layer> allLayers, IReadOnlyList<Coordinates> recordedMouseMovement, SKColor color);
|
|
public abstract void Use(Layer activeLayer, Layer previewLayer, IEnumerable<Layer> allLayers, IReadOnlyList<Coordinates> recordedMouseMovement, SKColor color);
|
|
@@ -51,6 +54,12 @@ namespace PixiEditor.Models.Tools
|
|
_change = null;
|
|
_change = null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ protected void ReportCustomSessionRect(SKRectI rect)
|
|
|
|
+ {
|
|
|
|
+ _rectReportedByTool = rect;
|
|
|
|
+ _customRectReported = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
private void InitializeStorageBasedChange(SKRectI toolSessionRect)
|
|
private void InitializeStorageBasedChange(SKRectI toolSessionRect)
|
|
{
|
|
{
|
|
Document doc = ViewModels.ViewModelMain.Current.BitmapManager.ActiveDocument;
|
|
Document doc = ViewModels.ViewModelMain.Current.BitmapManager.ActiveDocument;
|
|
@@ -72,6 +81,13 @@ namespace PixiEditor.Models.Tools
|
|
finalRect = SKRectI.Create(0, 0, doc.Width, doc.Height);
|
|
finalRect = SKRectI.Create(0, 0, doc.Width, doc.Height);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (_customRectReported)
|
|
|
|
+ {
|
|
|
|
+ _customRectReported = false;
|
|
|
|
+ finalRect = _rectReportedByTool;
|
|
|
|
+ _rectReportedByTool = SKRectI.Empty;
|
|
|
|
+ }
|
|
|
|
+
|
|
_change = new StorageBasedChange(doc, new[] { new LayerChunk(doc.ActiveLayer, finalRect) });
|
|
_change = new StorageBasedChange(doc, new[] { new LayerChunk(doc.ActiveLayer, finalRect) });
|
|
}
|
|
}
|
|
}
|
|
}
|