Files
Graphite/core/document/src/operation.rs
Till Arnold 2595662d83 Copy and paste layers MVP (#220)
* Initial implementation of copy and paste for layers

* Sort layers on copy and add tests

* Fix logger init for test

* Fix `copy_paste_deleted_layers` test

* Readd erroneously removed svg

* Make Layer serializable and cleanup

* Add test for copy and pasting folders

* Cleanup

* Rename left_mouseup

* Cleanup

* Add length check to test

* Fix typo

* Make mouseup, mousedown more consistent
2021-07-04 15:34:47 -07:00

71 lines
1.2 KiB
Rust

use crate::{
layers::{style, Layer},
LayerId,
};
use serde::{Deserialize, Serialize};
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub enum Operation {
AddEllipse {
path: Vec<LayerId>,
insert_index: isize,
transform: [f64; 6],
style: style::PathStyle,
},
AddRect {
path: Vec<LayerId>,
insert_index: isize,
transform: [f64; 6],
style: style::PathStyle,
},
AddLine {
path: Vec<LayerId>,
insert_index: isize,
transform: [f64; 6],
style: style::PathStyle,
},
AddPen {
path: Vec<LayerId>,
transform: [f64; 6],
insert_index: isize,
points: Vec<(f64, f64)>,
style: style::PathStyle,
},
AddShape {
path: Vec<LayerId>,
insert_index: isize,
transform: [f64; 6],
equal_sides: bool,
sides: u8,
style: style::PathStyle,
},
DeleteLayer {
path: Vec<LayerId>,
},
DuplicateLayer {
path: Vec<LayerId>,
},
PasteLayer {
layer: Layer,
path: Vec<LayerId>,
},
AddFolder {
path: Vec<LayerId>,
},
MountWorkingFolder {
path: Vec<LayerId>,
},
TransformLayer {
path: Vec<LayerId>,
transform: [f64; 6],
},
DiscardWorkingFolder,
ClearWorkingFolder,
CommitTransaction,
ToggleVisibility {
path: Vec<LayerId>,
},
}