Generify functions in document.rs (#488)

* Generify functions in document.rs
This commit is contained in:
TrueDoctor
2022-01-18 22:21:44 +01:00
committed by Keavon Chambers
parent 443f3d3b00
commit 72e638c5da
3 changed files with 37 additions and 20 deletions

View File

@@ -242,7 +242,7 @@ impl<'a> Selected<'a> {
let transformation = pivot * delta * pivot.inverse();
// TODO: Cache the result of `shallowest_unique_layers` to avoid this heavy computation every frame of movement, see https://github.com/GraphiteEditor/Graphite/pull/481
for layer_path in Document::shallowest_unique_layers(self.selected.iter().map(|path| path.as_slice())) {
for layer_path in Document::shallowest_unique_layers(self.selected.iter()) {
let parent_folder_path = &layer_path[..layer_path.len() - 1];
let original_layer_transforms = *self.original_transforms.get(layer_path).unwrap();

View File

@@ -236,10 +236,10 @@ impl Fsm for SelectToolFsmState {
let closest_move = data.snap_handler.snap_layers(document, &data.layers_dragging, mouse_delta);
// TODO: Cache the result of `shallowest_unique_layers` to avoid this heavy computation every frame of movement, see https://github.com/GraphiteEditor/Graphite/pull/481
for path in Document::shallowest_unique_layers(data.layers_dragging.iter().map(|path| path.as_slice())) {
for path in Document::shallowest_unique_layers(data.layers_dragging.iter()) {
responses.push_front(
Operation::TransformLayerInViewport {
path: path.to_vec(),
path: path.clone(),
transform: DAffine2::from_translation(mouse_delta + closest_move).to_cols_array(),
}
.into(),