Remove all references to legacy layers (#1523)

* Remove visible field from LegacyLayer

* Remove LegacyLayer wrapper around LegacyLayerType

* Remove FolderLegacyLayer and LayerLegacyLayer wrappers around their data

* Remove legacy layers
This commit is contained in:
Keavon Chambers
2023-12-19 20:50:45 -08:00
parent 9a7d7de8fa
commit dcd38f2e4c
26 changed files with 211 additions and 1078 deletions

View File

@@ -3,7 +3,6 @@ use crate::consts::{SNAP_AXIS_TOLERANCE, SNAP_POINT_TOLERANCE};
use crate::messages::prelude::*;
use document_legacy::document::LayerId;
use document_legacy::layers::layer_info::LegacyLayer;
use glam::DVec2;
@@ -102,66 +101,21 @@ impl SnapManager {
}
}
/// Add the [ManipulatorGroup]s (optionally including handles) of the specified shape layer to the snapping points
///
/// This should be called after start_snap
pub fn add_snap_path(
&mut self,
_document_message_handler: &DocumentMessageHandler,
_input: &InputPreprocessorMessageHandler,
_layer: &LegacyLayer,
_path: &[LayerId],
_include_handles: bool,
_ignore_points: &[ManipulatorPointInfo],
) {
todo!();
// let Some(vector_data) = &layer.as_vector_data() else { return };
// if !document_message_handler.snapping_state.node_snapping {
// return;
// };
// let transform = document_message_handler.document_legacy.multiply_transforms(path).unwrap();
// let snap_points = vector_data
// .manipulator_groups()
// .flat_map(|group| {
// if include_handles {
// [
// Some((ManipulatorPointId::new(group.id, SelectedType::Anchor), group.anchor)),
// group.in_handle.map(|pos| (ManipulatorPointId::new(group.id, SelectedType::InHandle), pos)),
// group.out_handle.map(|pos| (ManipulatorPointId::new(group.id, SelectedType::OutHandle), pos)),
// ]
// } else {
// [Some((ManipulatorPointId::new(group.id, SelectedType::Anchor), group.anchor)), None, None]
// }
// })
// .flatten()
// .filter(|&(point_id, _)| {
// !ignore_points.contains(&ManipulatorPointInfo {
// layer: LayerNodeIdentifier::from_path(path, document_message_handler.network()),
// point_id,
// })
// })
// .map(|(_, pos)| transform.transform_point2(pos));
// self.add_snap_points(document_message_handler, input, snap_points);
}
/// Adds all of the shape handles in the document, including bézier handles of the points specified
pub fn add_all_document_handles(
&mut self,
document_message_handler: &DocumentMessageHandler,
input: &InputPreprocessorMessageHandler,
include_handles: &[&[LayerId]],
exclude: &[&[LayerId]],
ignore_points: &[ManipulatorPointInfo],
_document_message_handler: &DocumentMessageHandler,
_input: &InputPreprocessorMessageHandler,
_include_handles: &[&[LayerId]],
_exclude: &[&[LayerId]],
_ignore_points: &[ManipulatorPointInfo],
) {
for path in document_message_handler.all_layers() {
if !exclude.contains(&path) {
let layer = document_message_handler.document_legacy.layer(path).expect("Could not get layer for snapping");
self.add_snap_path(document_message_handler, input, layer, path, include_handles.contains(&path), ignore_points);
}
}
// for path in document_message_handler.all_layers() {
// if !exclude.contains(&path) {
// let layer = document_message_handler.document_legacy.layer(path).expect("Could not get layer for snapping");
// self.add_snap_path(document_message_handler, input, layer, path, include_handles.contains(&path), ignore_points);
// }
// }
}
/// Finds the closest snap from an array of layers to the specified snap targets in viewport coords.