Move layer selection logic from vue to editor (#410)

* Add vue selectLayer(layer, ctrl, shift)

* Individual selection working, range fill next

* Frontend package-lock.json seems apparently needs to be pushed. Weird.

* Selection working with ctrl, shift from editor. Still some bugs to sqaush with folder nesting.

* WIP resolving nesting folders issues

* Changed comparison approach, handling corner cases now

* Fully working selection.

* Reverted changes to package-lock.json

* Removed unused code

* Resolved ctrl click not behaving similar to windows

* Slight comment clarification

* Double checked a windows behavior and corrected. Changed last_selected name.

* Simplified if statement slightly.

* Made the naming clearer regarding UUIDs versus indices

* Clarified comments further

* Minor comment fixup

* Implemented suggestions, clarified comments

* Resolved todo regarding clearing selection when ctrl not pressed

* Ensure we only push responses when needed

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Reviewed by: @TrueDoctor <3
This commit is contained in:
Oliver Davies 2021-12-22 17:45:14 -08:00 committed by Keavon Chambers
parent 30418c51f8
commit e54fedc6a5
7 changed files with 122 additions and 75 deletions

View file

@ -322,6 +322,11 @@ impl JsEditorHandle {
self.dispatch(message);
}
pub fn select_layer(&self, paths: Vec<LayerId>, ctrl: bool, shift: bool) {
let message = DocumentMessage::SelectLayer(paths, ctrl, shift);
self.dispatch(message);
}
/// Select all layers
pub fn select_all_layers(&self) {
let message = DocumentMessage::SelectAllLayers;
@ -443,7 +448,7 @@ impl JsEditorHandle {
/// Requests the backend to add a layer to the layer list
pub fn add_folder(&self, path: Vec<LayerId>) {
let message = DocumentMessage::CreateFolder(path);
let message = DocumentMessage::CreateEmptyFolder(path);
self.dispatch(message);
}
}