public void MethodTransformAdd(Vector2 vector) { // History LayersTransformAddHistory history = new LayersTransformAddHistory(HistoryType.LayersTransformAdd_Move); // Selection this.CacheTransformer(); this.Transformer = Transformer.Add(this.StartingTransformer, vector); this.SetValueWithChildren((layerage) => { ILayer layer = layerage.Self; // History history.PushTransform(layer, vector); // Refactoring layer.IsRefactoringTransformer = true; layer.IsRefactoringRender = true; layer.IsRefactoringIconRender = true; layerage.RefactoringParentsTransformer(); layerage.RefactoringParentsRender(); layerage.RefactoringParentsIconRender(); layer.CacheTransform(); layer.TransformAdd(vector); }); // History this.HistoryPush(history); this.Invalidate(); // Invalidate }
public void MethodTransformMultiplies(Matrix3x2 matrix) { // History LayersTransformMultipliesHistory history = new LayersTransformMultipliesHistory(HistoryType.LayersTransformMultiplies_Transform); // Selection this.CacheTransformer(); Transformer transformer = this.StartingTransformer * matrix; this.Transformer = transformer; this.SetValueWithChildren((layerage) => { ILayer layer = layerage.Self; // History history.PushTransform(layer); // Refactoring layer.IsRefactoringRender = true; layer.IsRefactoringIconRender = true; layerage.RefactoringParentsTransformer(); layer.CacheTransform(); layer.TransformMultiplies(matrix); }); // History this.HistoryPush(history); this.Invalidate(); // Invalidate }
public void MethodTransformAddStarted() { // Selection this.CacheTransformer(); this.SetValueWithChildren((layerage) => { ILayer layer = layerage.Self; layer.CacheTransform(); }); this.Invalidate(InvalidateMode.Thumbnail); // Invalidate }
public void MethodSetup(BitmapSize bitmapSize, IndicatorMode indicatorMode) { if (this.CanvasTransformer == bitmapSize) { return; } Vector2 previousVector = this.CanvasTransformer.GetIndicatorVector(indicatorMode); //History LayersSetupTransformAddHistory history = new LayersSetupTransformAddHistory("Set canvas size", this.CanvasTransformer); //CanvasTransformer this.CanvasTransformer.BitmapSize = bitmapSize; this.CanvasTransformer.ReloadMatrix(); Vector2 vector = this.CanvasTransformer.GetIndicatorVector(indicatorMode); Vector2 distance = vector - previousVector; //LayerageCollection foreach (Layerage layerage in this.LayerageCollection.RootLayerages) { //Selection this.SetLayerageValueWithChildren(layerage, (layerage2) => { ILayer layer = layerage2.Self; //History history.PushTransform(layer, distance); //Refactoring layer.IsRefactoringTransformer = true; layer.IsRefactoringRender = true; layer.IsRefactoringIconRender = true; //layerage.RefactoringParentsTransformer(); //layerage.RefactoringParentsRender(); //layerage.RefactoringParentsIconRender(); layer.CacheTransform(); layer.TransformAdd(distance); }); } //History this.HistoryPush(history); //Selection this.SetMode(this.LayerageCollection); this.Invalidate();//Invalidate }
private void TransformAlign(float positionValue, BorderMode borderMode, Orientation orientation) { // History LayersTransformAddHistory history = new LayersTransformAddHistory(HistoryType.LayersTransformAdd_Move); // Selection this.SelectionViewModel.SetValue((layerage) => { Transformer transformer = layerage.GetActualTransformer(); float value = transformer.GetBorderValue(borderMode); float distance = positionValue - value; if (distance == 0) { return; } Vector2 vector = orientation == Orientation.Horizontal ? new Vector2(distance, 0) : new Vector2(0, distance); layerage.SetValueWithChildren((layerage2) => { ILayer layer = layerage2.Self; // History history.PushTransform(layer, vector); // Refactoring layer.IsRefactoringTransformer = true; layer.IsRefactoringRender = true; layer.IsRefactoringIconRender = true; layerage.RefactoringParentsTransformer(); layerage.RefactoringParentsRender(); layerage.RefactoringParentsIconRender(); layer.CacheTransform(); layer.TransformAdd(vector); }); }); // Refactoring this.SelectionViewModel.Transformer = this.SelectionViewModel.RefactoringTransformer(); // History this.ViewModel.HistoryPush(history); this.ViewModel.Invalidate(); // Invalidate} }
public void MethodSetup(BitmapSize bitmapSize) { if (this.CanvasTransformer == bitmapSize) { return; } Vector2 scale = this.CanvasTransformer.GetScale(bitmapSize); Matrix3x2 matrix = Matrix3x2.CreateScale(scale); //History LayersSetupTransformMultipliesHistory history = new LayersSetupTransformMultipliesHistory("Set canvas size", this.CanvasTransformer); //CanvasTransformer this.CanvasTransformer.BitmapSize = bitmapSize; this.CanvasTransformer.ReloadMatrix(); //LayerageCollection foreach (Layerage layerage in this.LayerageCollection.RootLayerages) { //Selection this.SetLayerageValueWithChildren(layerage, (layerage2) => { ILayer layer = layerage2.Self; //History history.PushTransform(layer); //Refactoring layer.IsRefactoringTransformer = true; layer.IsRefactoringRender = true; layer.IsRefactoringIconRender = true; //layerage.RefactoringParentsTransformer(); //layerage.RefactoringParentsRender(); //layerage.RefactoringParentsIconRender(); layer.CacheTransform(); layer.TransformMultiplies(matrix); }); } //History this.HistoryPush(history); //Selection this.SetMode(this.LayerageCollection); this.Invalidate();//Invalidate }
/// <summary> Undo method. </summary> public override void Undo() { foreach (var undo in this.UndoActions) { ILayer layer = undo.Key; Vector2 previous = undo.Value; //Refactoring layer.IsRefactoringTransformer = true; layer.IsRefactoringRender = true; layer.IsRefactoringIconRender = true; //undo.RefactoringParentsTransformer(); //undo.RefactoringParentsRender(); //undo.RefactoringParentsIconRender(); layer.CacheTransform(); layer.TransformAdd(-previous); } }
/// <summary> Undo method. </summary> public override void Undo() { foreach (var undo in this.UndoActions) { ILayer layer = undo.Key; Transformer transformer = layer.Transform.Transformer; Matrix3x2 matrix = Transformer.FindHomography(transformer, undo.Value); //Refactoring layer.IsRefactoringTransformer = true; layer.IsRefactoringRender = true; layer.IsRefactoringIconRender = true; //undo.RefactoringParentsTransformer(); //undo.RefactoringParentsRender(); //undo.RefactoringParentsIconRender(); layer.CacheTransform(); layer.TransformMultiplies(matrix); } }