From 7f9c59dd99e7134fc1154a55d541cf14bf8bfd70 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Sun, 23 Oct 2022 17:29:04 -0700 Subject: [PATCH] Refactor color picker floating menu (#809) * Move FloatingMenu template component * Rewrite the ColorPicker component so it's not horrifically bad code * Move FloatingMenu into the ColorPicker component * Little Imaginate fixes * Add todo --- .../document/document_message_handler.rs | 2 +- .../properties_panel/utility_functions.rs | 2 +- .../components/floating-menus/ColorPicker.vue | 245 +++++------------- .../components/floating-menus/DialogModal.vue | 4 +- .../floating-menus/EyedropperPreview.vue | 2 +- .../components/floating-menus/MenuList.vue | 2 +- .../FloatingMenu.vue | 0 .../widgets/buttons/PopoverButton.vue | 2 +- .../components/widgets/inputs/ColorInput.vue | 36 +-- .../components/widgets/inputs/FontInput.vue | 2 +- .../widgets/inputs/SwatchPairInput.vue | 23 +- frontend/src/utility-functions/color.ts | 58 ----- frontend/src/wasm-communication/messages.ts | 85 ++++-- frontend/wasm/src/editor_api.rs | 4 +- 14 files changed, 177 insertions(+), 290 deletions(-) rename frontend/src/components/{floating-menus => layout}/FloatingMenu.vue (100%) delete mode 100644 frontend/src/utility-functions/color.ts diff --git a/editor/src/messages/portfolio/document/document_message_handler.rs b/editor/src/messages/portfolio/document/document_message_handler.rs index 376bbe57..20dd6262 100644 --- a/editor/src/messages/portfolio/document/document_message_handler.rs +++ b/editor/src/messages/portfolio/document/document_message_handler.rs @@ -990,7 +990,7 @@ impl DocumentMessageHandler { DocumentRenderMode::OnlyBelowLayerInFolder(below_layer_path) => self.graphene_document.render_layers_below(below_layer_path, render_data).unwrap(), }; let artboards = self.artboard_message_handler.artboards_graphene_document.render_root(render_data); - let outside_artboards_color = if self.artboard_message_handler.artboard_ids.is_empty() { "#ffffff" } else { "#000000" }; + let outside_artboards_color = if self.artboard_message_handler.artboard_ids.is_empty() { "#ffffff" } else { "#222222" }; let outside_artboards = format!(r#""#, outside_artboards_color); let matrix = transform .to_cols_array() diff --git a/editor/src/messages/portfolio/document/properties_panel/utility_functions.rs b/editor/src/messages/portfolio/document/properties_panel/utility_functions.rs index 4758fa59..14bbf10d 100644 --- a/editor/src/messages/portfolio/document/properties_panel/utility_functions.rs +++ b/editor/src/messages/portfolio/document/properties_panel/utility_functions.rs @@ -914,7 +914,7 @@ fn node_section_imaginate(imaginate_layer: &ImaginateLayer, layer: &Layer, persi \n\ Include an artist name like \"Rembrandt\" or art medium like \"watercolor\" or \"photography\" to influence the look. List multiple to meld styles.\n\ \n\ - To boost (or lessen) the importance of a word or phrase, wrap it in quotes ending with a colon and a multiplier, for example:\n\ + To boost (or lessen) the importance of a word or phrase, wrap it in parentheses ending with a colon and a multiplier, for example:\n\ \"Colorless green ideas (sleep:1.3) furiously\" " .trim() diff --git a/frontend/src/components/floating-menus/ColorPicker.vue b/frontend/src/components/floating-menus/ColorPicker.vue index 17db19d7..9e2cf743 100644 --- a/frontend/src/components/floating-menus/ColorPicker.vue +++ b/frontend/src/components/floating-menus/ColorPicker.vue @@ -1,30 +1,29 @@