@@ -118,17 +118,6 @@ impl DocumentMessageHandler {
118118 fn layerdata_mut ( & mut self , path : & [ LayerId ] ) -> & mut LayerData {
119119 self . active_document_mut ( ) . layer_data . entry ( path. to_vec ( ) ) . or_insert_with ( || LayerData :: new ( true ) )
120120 }
121- #[ allow( dead_code) ]
122- fn create_transform_from_layerdata ( & self , path : Vec < u64 > , responses : & mut VecDeque < Message > ) {
123- let layerdata = self . layerdata ( & path) ;
124- responses. push_back (
125- DocumentOperation :: SetLayerTransform {
126- path,
127- transform : layerdata. calculate_transform ( ) . to_cols_array ( ) ,
128- }
129- . into ( ) ,
130- ) ;
131- }
132121 fn create_document_transform_from_layerdata ( & self , viewport_size : & ViewportPosition , responses : & mut VecDeque < Message > ) {
133122 let half_viewport = viewport_size. as_dvec2 ( ) / 2. ;
134123 let layerdata = self . layerdata ( & [ ] ) ;
@@ -142,18 +131,18 @@ impl DocumentMessageHandler {
142131 ) ;
143132 }
144133
145- /// Returns the paths to all layers in order, optionally including only selected layers
134+ /// Returns the paths to all layers in order, optionally including only selected or non
135+ /// selected layers.
146136 fn layers_sorted ( & self , selected : Option < bool > ) -> Vec < Vec < LayerId > > {
147137 // Compute the indices for each layer to be able to sort them
148- // TODO: Replace with drain_filter https://github.com/rust-lang/rust/issues/59618
149138 let mut layers_with_indices: Vec < ( Vec < LayerId > , Vec < usize > ) > = self
150139 . active_document ( )
151140 . layer_data
152141 . iter ( )
153142 // 'path.len() > 0' filters out root layer since it has no indices
154143 . filter_map ( |( path, data) | ( !path. is_empty ( ) && ( data. selected == selected. unwrap_or ( data. selected ) ) ) . then ( || path. clone ( ) ) )
155144 . filter_map ( |path| {
156- // Currently it is possible that layer_data contains layers that are don't actually exist
145+ // Currently it is possible that layer_data contains layers that are don't actually exist (has been partially fixed in #281)
157146 // and thus indices_for_path can return an error. We currently skip these layers and log a warning.
158147 // Once this problem is solved this code can be simplified
159148 match self . active_document ( ) . document . indices_for_path ( & path) {
@@ -180,7 +169,8 @@ impl DocumentMessageHandler {
180169 self . layers_sorted ( Some ( true ) )
181170 }
182171
183- /// Returns the paths to all selected layers in order
172+ /// Returns the paths to all non_selected layers in order
173+ #[ allow( dead_code) ] // used for test cases
184174 pub fn non_selected_layers_sorted ( & self ) -> Vec < Vec < LayerId > > {
185175 self . layers_sorted ( Some ( false ) )
186176 }
0 commit comments