Remove the "coming soon" dialog and hide not-yet-ready features/tools

This commit is contained in:
Keavon Chambers
2025-12-05 04:17:44 -08:00
parent 74d9c911bd
commit 5b472a64b2
18 changed files with 122 additions and 237 deletions
@@ -25,9 +25,6 @@ pub enum DialogMessage {
localized_commit_date: String, localized_commit_date: String,
localized_commit_year: String, localized_commit_year: String,
}, },
RequestComingSoonDialog {
issue: Option<u32>,
},
RequestDemoArtworkDialog, RequestDemoArtworkDialog,
RequestExportDialog, RequestExportDialog,
RequestLicensesDialogWithLocalizedCommitDate { RequestLicensesDialogWithLocalizedCommitDate {
@@ -1,4 +1,4 @@
use super::simple_dialogs::{self, AboutGraphiteDialog, ComingSoonDialog, DemoArtworkDialog, LicensesDialog}; use super::simple_dialogs::{self, AboutGraphiteDialog, DemoArtworkDialog, LicensesDialog};
use crate::messages::dialog::simple_dialogs::LicensesThirdPartyDialog; use crate::messages::dialog::simple_dialogs::LicensesThirdPartyDialog;
use crate::messages::layout::utility_types::widget_prelude::*; use crate::messages::layout::utility_types::widget_prelude::*;
use crate::messages::prelude::*; use crate::messages::prelude::*;
@@ -62,10 +62,6 @@ impl MessageHandler<DialogMessage, DialogMessageContext<'_>> for DialogMessageHa
dialog.send_dialog_to_frontend(responses); dialog.send_dialog_to_frontend(responses);
} }
DialogMessage::RequestComingSoonDialog { issue } => {
let dialog = ComingSoonDialog { issue };
dialog.send_dialog_to_frontend(responses);
}
DialogMessage::RequestDemoArtworkDialog => { DialogMessage::RequestDemoArtworkDialog => {
let dialog = DemoArtworkDialog; let dialog = DemoArtworkDialog;
dialog.send_dialog_to_frontend(responses); dialog.send_dialog_to_frontend(responses);
@@ -1,48 +0,0 @@
use crate::messages::layout::utility_types::widget_prelude::*;
use crate::messages::prelude::*;
/// A dialog to notify users of an unfinished issue, optionally with an issue number.
pub struct ComingSoonDialog {
pub issue: Option<u32>,
}
impl DialogLayoutHolder for ComingSoonDialog {
const ICON: &'static str = "Delay";
const TITLE: &'static str = "Coming Soon";
fn layout_buttons(&self) -> Layout {
let widgets = vec![TextButton::new("OK").emphasized(true).on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance()];
Layout(vec![LayoutGroup::Row { widgets }])
}
}
impl LayoutHolder for ComingSoonDialog {
fn layout(&self) -> Layout {
let header = vec![TextLabel::new("You've stumbled upon a placeholder").bold(true).widget_instance()];
let row1 = vec![TextLabel::new("This feature is not implemented yet.").widget_instance()];
let mut rows = vec![LayoutGroup::Row { widgets: header }, LayoutGroup::Row { widgets: row1 }];
if let Some(issue) = self.issue {
let row2 = vec![TextLabel::new("But you can help build it! Visit its issue:").widget_instance()];
let row3 = vec![
TextButton::new(format!("GitHub Issue #{issue}"))
.icon(Some("Website".into()))
.flush(true)
.on_update(move |_| {
FrontendMessage::TriggerVisitLink {
url: format!("https://github.com/GraphiteEditor/Graphite/issues/{issue}"),
}
.into()
})
.widget_instance(),
];
rows.push(LayoutGroup::Row { widgets: row2 });
rows.push(LayoutGroup::Row { widgets: row3 });
}
Layout(rows)
}
}
@@ -1,7 +1,6 @@
mod about_graphite_dialog; mod about_graphite_dialog;
mod close_all_documents_dialog; mod close_all_documents_dialog;
mod close_document_dialog; mod close_document_dialog;
mod coming_soon_dialog;
mod demo_artwork_dialog; mod demo_artwork_dialog;
mod error_dialog; mod error_dialog;
mod licenses_dialog; mod licenses_dialog;
@@ -10,7 +9,6 @@ mod licenses_third_party_dialog;
pub use about_graphite_dialog::AboutGraphiteDialog; pub use about_graphite_dialog::AboutGraphiteDialog;
pub use close_all_documents_dialog::CloseAllDocumentsDialog; pub use close_all_documents_dialog::CloseAllDocumentsDialog;
pub use close_document_dialog::CloseDocumentDialog; pub use close_document_dialog::CloseDocumentDialog;
pub use coming_soon_dialog::ComingSoonDialog;
pub use demo_artwork_dialog::ARTWORK; pub use demo_artwork_dialog::ARTWORK;
pub use demo_artwork_dialog::DemoArtworkDialog; pub use demo_artwork_dialog::DemoArtworkDialog;
pub use error_dialog::ErrorDialog; pub use error_dialog::ErrorDialog;
@@ -224,9 +224,6 @@ pub enum FrontendMessage {
#[serde(rename = "dataBuffer")] #[serde(rename = "dataBuffer")]
data_buffer: JsRawBuffer, data_buffer: JsRawBuffer,
}, },
UpdateDocumentModeLayout {
diff: Vec<WidgetDiff>,
},
UpdateDocumentRulers { UpdateDocumentRulers {
origin: (f64, f64), origin: (f64, f64),
spacing: f64, spacing: f64,
@@ -8,6 +8,7 @@ use crate::messages::input_mapper::utility_types::misc::{KeyMappingEntries, Mapp
use crate::messages::portfolio::document::node_graph::utility_types::Direction; use crate::messages::portfolio::document::node_graph::utility_types::Direction;
use crate::messages::portfolio::document::utility_types::clipboards::Clipboard; use crate::messages::portfolio::document::utility_types::clipboards::Clipboard;
use crate::messages::portfolio::document::utility_types::misc::GroupFolderType; use crate::messages::portfolio::document::utility_types::misc::GroupFolderType;
use crate::messages::portfolio::utility_types::KeyboardPlatformLayout;
use crate::messages::prelude::*; use crate::messages::prelude::*;
use crate::messages::tool::tool_messages::brush_tool::BrushToolMessageOptionsUpdate; use crate::messages::tool::tool_messages::brush_tool::BrushToolMessageOptionsUpdate;
use crate::messages::tool::tool_messages::select_tool::SelectToolPointerKeys; use crate::messages::tool::tool_messages::select_tool::SelectToolPointerKeys;
@@ -493,16 +494,20 @@ pub fn input_mappings() -> Mapping {
pub fn zoom_with_scroll() -> Mapping { pub fn zoom_with_scroll() -> Mapping {
use InputMapperMessage::*; use InputMapperMessage::*;
// On Mac, the OS already converts Shift+scroll into horizontal scrolling so we have to reverse the behavior from normal to produce the same outcome
let keyboard_platform = GLOBAL_PLATFORM.get().copied().unwrap_or_default().as_keyboard_platform_layout();
let mut mapping = input_mappings(); let mut mapping = input_mappings();
let remove = [ let remove = [
entry!(WheelScroll; modifiers=[Control], action_dispatch=NavigationMessage::CanvasZoomMouseWheel), entry!(WheelScroll; modifiers=[Control], action_dispatch=NavigationMessage::CanvasZoomMouseWheel),
entry!(WheelScroll; modifiers=[Command], action_dispatch=NavigationMessage::CanvasZoomMouseWheel),
entry!(WheelScroll; modifiers=[Shift], action_dispatch=NavigationMessage::CanvasPanMouseWheel { use_y_as_x: true }), entry!(WheelScroll; modifiers=[Shift], action_dispatch=NavigationMessage::CanvasPanMouseWheel { use_y_as_x: true }),
entry!(WheelScroll; action_dispatch=NavigationMessage::CanvasPanMouseWheel { use_y_as_x: false }), entry!(WheelScroll; action_dispatch=NavigationMessage::CanvasPanMouseWheel { use_y_as_x: false }),
]; ];
let add = [ let add = [
entry!(WheelScroll; modifiers=[Control], action_dispatch=NavigationMessage::CanvasPanMouseWheel { use_y_as_x: true }), entry!(WheelScroll; modifiers=[Control], action_dispatch=NavigationMessage::CanvasPanMouseWheel { use_y_as_x: keyboard_platform == KeyboardPlatformLayout::Mac }),
entry!(WheelScroll; modifiers=[Shift], action_dispatch=NavigationMessage::CanvasPanMouseWheel { use_y_as_x: false }), entry!(WheelScroll; modifiers=[Shift], action_dispatch=NavigationMessage::CanvasPanMouseWheel { use_y_as_x: keyboard_platform != KeyboardPlatformLayout::Mac }),
entry!(WheelScroll; action_dispatch=NavigationMessage::CanvasZoomMouseWheel), entry!(WheelScroll; action_dispatch=NavigationMessage::CanvasZoomMouseWheel),
]; ];
@@ -505,7 +505,6 @@ impl LayoutMessageHandler {
LayoutTarget::DialogColumn1 => FrontendMessage::UpdateDialogColumn1 { diff }, LayoutTarget::DialogColumn1 => FrontendMessage::UpdateDialogColumn1 { diff },
LayoutTarget::DialogColumn2 => FrontendMessage::UpdateDialogColumn2 { diff }, LayoutTarget::DialogColumn2 => FrontendMessage::UpdateDialogColumn2 { diff },
LayoutTarget::DocumentBar => FrontendMessage::UpdateDocumentBarLayout { diff }, LayoutTarget::DocumentBar => FrontendMessage::UpdateDocumentBarLayout { diff },
LayoutTarget::DocumentMode => FrontendMessage::UpdateDocumentModeLayout { diff },
LayoutTarget::LayersPanelBottomBar => FrontendMessage::UpdateLayersPanelBottomBarLayout { diff }, LayoutTarget::LayersPanelBottomBar => FrontendMessage::UpdateLayersPanelBottomBarLayout { diff },
LayoutTarget::LayersPanelControlLeftBar => FrontendMessage::UpdateLayersPanelControlBarLeftLayout { diff }, LayoutTarget::LayersPanelControlLeftBar => FrontendMessage::UpdateLayersPanelControlBarLeftLayout { diff },
LayoutTarget::LayersPanelControlRightBar => FrontendMessage::UpdateLayersPanelControlBarRightLayout { diff }, LayoutTarget::LayersPanelControlRightBar => FrontendMessage::UpdateLayersPanelControlBarRightLayout { diff },
@@ -29,8 +29,6 @@ pub enum LayoutTarget {
DialogColumn2, DialogColumn2,
/// Contains the widgets located directly above the canvas to the right, for example the zoom in and out buttons. /// Contains the widgets located directly above the canvas to the right, for example the zoom in and out buttons.
DocumentBar, DocumentBar,
/// Contains the dropdown for design / select / guide mode found on the top left of the canvas.
DocumentMode,
/// Controls for adding, grouping, and deleting layers at the bottom of the Layers panel. /// Controls for adding, grouping, and deleting layers at the bottom of the Layers panel.
LayersPanelBottomBar, LayersPanelBottomBar,
/// Blending options at the top of the Layers panel. /// Blending options at the top of the Layers panel.
@@ -45,7 +43,7 @@ pub enum LayoutTarget {
PropertiesPanel, PropertiesPanel,
/// The contextual input key/mouse combination shortcuts shown in the status bar at the bottom of the window. /// The contextual input key/mouse combination shortcuts shown in the status bar at the bottom of the window.
StatusBarHints, StatusBarHints,
/// The bar directly above the canvas, left-aligned and to the right of the document mode dropdown. /// The left side of the control bar directly above the canvas.
ToolOptions, ToolOptions,
/// The vertical buttons for all of the tools on the left of the canvas. /// The vertical buttons for all of the tools on the left of the canvas.
ToolShelf, ToolShelf,
@@ -17,7 +17,7 @@ use crate::messages::portfolio::document::overlays::grid_overlays::{grid_overlay
use crate::messages::portfolio::document::overlays::utility_types::{OverlaysType, OverlaysVisibilitySettings}; use crate::messages::portfolio::document::overlays::utility_types::{OverlaysType, OverlaysVisibilitySettings};
use crate::messages::portfolio::document::properties_panel::properties_panel_message_handler::PropertiesPanelMessageContext; use crate::messages::portfolio::document::properties_panel::properties_panel_message_handler::PropertiesPanelMessageContext;
use crate::messages::portfolio::document::utility_types::document_metadata::{DocumentMetadata, LayerNodeIdentifier}; use crate::messages::portfolio::document::utility_types::document_metadata::{DocumentMetadata, LayerNodeIdentifier};
use crate::messages::portfolio::document::utility_types::misc::{AlignAggregate, AlignAxis, DocumentMode, FlipAxis, PTZ}; use crate::messages::portfolio::document::utility_types::misc::{AlignAggregate, AlignAxis, FlipAxis, PTZ};
use crate::messages::portfolio::document::utility_types::network_interface::{FlowType, InputConnector, NodeTemplate}; use crate::messages::portfolio::document::utility_types::network_interface::{FlowType, InputConnector, NodeTemplate};
use crate::messages::portfolio::document::utility_types::nodes::RawBuffer; use crate::messages::portfolio::document::utility_types::nodes::RawBuffer;
use crate::messages::portfolio::utility_types::PanelType; use crate::messages::portfolio::utility_types::PanelType;
@@ -91,8 +91,6 @@ pub struct DocumentMessageHandler {
pub commit_hash: String, pub commit_hash: String,
/// The current pan, tilt, and zoom state of the viewport's view of the document canvas. /// The current pan, tilt, and zoom state of the viewport's view of the document canvas.
pub document_ptz: PTZ, pub document_ptz: PTZ,
/// The current mode that the document is in, which starts out as Design Mode. This choice affects the editing behavior of the tools.
pub document_mode: DocumentMode,
/// The current mode that the user has set for rendering the document within the viewport. /// The current mode that the user has set for rendering the document within the viewport.
/// This is usually "Normal" but can be set to "Outline" or "Pixels" to see the canvas differently. /// This is usually "Normal" but can be set to "Outline" or "Pixels" to see the canvas differently.
#[serde(alias = "view_mode")] #[serde(alias = "view_mode")]
@@ -164,7 +162,6 @@ impl Default for DocumentMessageHandler {
collapsed: CollapsedLayers::default(), collapsed: CollapsedLayers::default(),
commit_hash: GRAPHITE_GIT_COMMIT_HASH.to_string(), commit_hash: GRAPHITE_GIT_COMMIT_HASH.to_string(),
document_ptz: PTZ::default(), document_ptz: PTZ::default(),
document_mode: DocumentMode::DesignMode,
render_mode: RenderMode::default(), render_mode: RenderMode::default(),
overlays_visibility_settings: OverlaysVisibilitySettings::default(), overlays_visibility_settings: OverlaysVisibilitySettings::default(),
rulers_visible: true, rulers_visible: true,
@@ -1859,8 +1856,6 @@ impl DocumentMessageHandler {
pub commit_hash: String, pub commit_hash: String,
/// The current pan, tilt, and zoom state of the viewport's view of the document canvas. /// The current pan, tilt, and zoom state of the viewport's view of the document canvas.
pub document_ptz: PTZ, pub document_ptz: PTZ,
/// The current mode that the document is in, which starts out as Design Mode. This choice affects the editing behavior of the tools.
pub document_mode: DocumentMode,
/// The current mode that the user has set for rendering the document within the viewport. /// The current mode that the user has set for rendering the document within the viewport.
/// This is usually "Normal" but can be set to "Outline" or "Pixels" to see the canvas differently. /// This is usually "Normal" but can be set to "Outline" or "Pixels" to see the canvas differently.
pub view_mode: RenderMode, pub view_mode: RenderMode,
@@ -1880,7 +1875,6 @@ impl DocumentMessageHandler {
collapsed: old_message_handler.collapsed, collapsed: old_message_handler.collapsed,
commit_hash: old_message_handler.commit_hash, commit_hash: old_message_handler.commit_hash,
document_ptz: old_message_handler.document_ptz, document_ptz: old_message_handler.document_ptz,
document_mode: old_message_handler.document_mode,
render_mode: old_message_handler.view_mode, render_mode: old_message_handler.view_mode,
overlays_visibility_settings: old_message_handler.overlays_visibility_settings, overlays_visibility_settings: old_message_handler.overlays_visibility_settings,
rulers_visible: old_message_handler.rulers_visible, rulers_visible: old_message_handler.rulers_visible,
@@ -2193,36 +2187,36 @@ impl DocumentMessageHandler {
} }
pub fn update_document_widgets(&self, responses: &mut VecDeque<Message>, animation_is_playing: bool, time: Duration) { pub fn update_document_widgets(&self, responses: &mut VecDeque<Message>, animation_is_playing: bool, time: Duration) {
// Document mode (dropdown menu at the left of the bar above the viewport, before the tool options) // // Document mode (dropdown menu at the left of the bar above the viewport, before the tool options)
// let layout = Layout(vec![LayoutGroup::Row {
let layout = Layout(vec![LayoutGroup::Row { // widgets: vec![
widgets: vec![ // DropdownInput::new(
// DropdownInput::new( // vec![vec![
// vec![vec![ // MenuListEntry::new(format!("{:?}", DocumentMode::DesignMode))
// MenuListEntry::new(format!("{:?}", DocumentMode::DesignMode)) // .label(DocumentMode::DesignMode.to_string())
// .label(DocumentMode::DesignMode.to_string()) // .icon(DocumentMode::DesignMode.icon_name()),
// .icon(DocumentMode::DesignMode.icon_name()), // // TODO: See issue #330
// MenuListEntry::new(format!("{:?}", DocumentMode::SelectMode)) // MenuListEntry::new(format!("{:?}", DocumentMode::SelectMode))
// .label(DocumentMode::SelectMode.to_string()) // .label(DocumentMode::SelectMode.to_string())
// .icon(DocumentMode::SelectMode.icon_name()) // .icon(DocumentMode::SelectMode.icon_name())
// .on_commit(|_| DialogMessage::RequestComingSoonDialog { issue: Some(330) }.into()), // .on_commit(|_| todo!()),
// MenuListEntry::new(format!("{:?}", DocumentMode::GuideMode)) // // TODO: See issue #331
// .label(DocumentMode::GuideMode.to_string()) // MenuListEntry::new(format!("{:?}", DocumentMode::GuideMode))
// .icon(DocumentMode::GuideMode.icon_name()) // .label(DocumentMode::GuideMode.to_string())
// .on_commit(|_| DialogMessage::RequestComingSoonDialog { issue: Some(331) }.into()), // .icon(DocumentMode::GuideMode.icon_name())
// ]]) // .on_commit(|_| todo!()),
// .selected_index(Some(self.document_mode as u32)) // ]])
// .draw_icon(true) // .selected_index(Some(self.document_mode as u32))
// .interactive(false) // TODO: set to true when dialogs are not spawned // .draw_icon(true)
// .widget_instance(), // .interactive(false)
// Separator::new(SeparatorType::Section).widget_instance(), // .widget_instance(),
], // Separator::new(SeparatorType::Section).widget_instance(),
}]); // ],
// }]);
responses.add(LayoutMessage::SendLayout { // responses.add(LayoutMessage::SendLayout {
layout, // layout,
layout_target: LayoutTarget::DocumentMode, // layout_target: LayoutTarget::DocumentMode,
}); // });
// Document bar (right portion of the bar above the viewport) // Document bar (right portion of the bar above the viewport)
@@ -2581,29 +2575,20 @@ impl DocumentMessageHandler {
.icon("RenderModeOutline") .icon("RenderModeOutline")
.tooltip_label("Render Mode: Outline") .tooltip_label("Render Mode: Outline")
.on_update(|_| DocumentMessage::SetRenderMode { render_mode: RenderMode::Outline }.into()), .on_update(|_| DocumentMessage::SetRenderMode { render_mode: RenderMode::Outline }.into()),
// TODO: See issue #320
// RadioEntryData::new("PixelPreview") // RadioEntryData::new("PixelPreview")
// .icon("RenderModePixels") // .icon("RenderModePixels")
// .tooltip_label("Render Mode: Pixel Preview") // .tooltip_label("Render Mode: Pixel Preview")
// .on_update(|_| DialogMessage::RequestComingSoonDialog { issue: Some(320) }.into()), // .on_update(|_| todo!()),
// TODO: See issue #1845
// RadioEntryData::new("SvgPreview") // RadioEntryData::new("SvgPreview")
// .icon("RenderModeSvg") // .icon("RenderModeSvg")
// .tooltip_label("Render Mode: SVG Preview") // .tooltip_label("Render Mode: SVG Preview")
// .on_update(|_| DialogMessage::RequestComingSoonDialog { issue: Some(1845) }.into()), // .on_update(|_| todo!()),
]) ])
.selected_index(Some(self.render_mode as u32)) .selected_index(Some(self.render_mode as u32))
.narrow(true) .narrow(true)
.widget_instance(), .widget_instance(),
// PopoverButton::new().popover_layout(
// Layout(vec![
// LayoutGroup::Row {
// widgets: vec![TextLabel::new("Render Mode").bold(true).widget_instance()],
// },
// LayoutGroup::Row {
// widgets: vec![TextLabel::new("Coming soon").widget_instance()],
// },
// ])
// .widget_instance(),
// ),
Separator::new(SeparatorType::Unrelated).widget_instance(), Separator::new(SeparatorType::Unrelated).widget_instance(),
]; ];
@@ -204,7 +204,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
NodeGraphMessage::CreateWire { output_connector, input_connector } => { NodeGraphMessage::CreateWire { output_connector, input_connector } => {
// TODO: Add support for flattening NodeInput::Import exports in flatten_with_fns https://github.com/GraphiteEditor/Graphite/issues/1762 // TODO: Add support for flattening NodeInput::Import exports in flatten_with_fns https://github.com/GraphiteEditor/Graphite/issues/1762
if matches!(input_connector, InputConnector::Export(_)) && matches!(output_connector, OutputConnector::Import { .. }) { if matches!(input_connector, InputConnector::Export(_)) && matches!(output_connector, OutputConnector::Import { .. }) {
responses.add(DialogMessage::RequestComingSoonDialog { issue: Some(1762) }); // We return early for now until this case becomes supported, then we can remove this
return; return;
} }
network_interface.create_wire(&output_connector, &input_connector, selection_network_path); network_interface.create_wire(&output_connector, &input_connector, selection_network_path);
@@ -26,33 +26,33 @@ pub enum AlignAggregate {
Center, Center,
} }
#[derive(Default, PartialEq, Eq, Clone, Copy, Debug, serde::Serialize, serde::Deserialize)] // #[derive(Default, PartialEq, Eq, Clone, Copy, Debug, serde::Serialize, serde::Deserialize)]
pub enum DocumentMode { // pub enum DocumentMode {
#[default] // #[default]
DesignMode, // DesignMode,
SelectMode, // SelectMode,
GuideMode, // GuideMode,
} // }
impl fmt::Display for DocumentMode { // impl fmt::Display for DocumentMode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self { // match self {
DocumentMode::DesignMode => write!(f, "Design Mode"), // DocumentMode::DesignMode => write!(f, "Design Mode"),
DocumentMode::SelectMode => write!(f, "Select Mode"), // DocumentMode::SelectMode => write!(f, "Select Mode"),
DocumentMode::GuideMode => write!(f, "Guide Mode"), // DocumentMode::GuideMode => write!(f, "Guide Mode"),
} // }
} // }
} // }
impl DocumentMode { // impl DocumentMode {
pub fn icon_name(&self) -> String { // pub fn icon_name(&self) -> String {
match self { // match self {
DocumentMode::DesignMode => "ViewportDesignMode".to_string(), // DocumentMode::DesignMode => "ViewportDesignMode".to_string(),
DocumentMode::SelectMode => "ViewportSelectMode".to_string(), // DocumentMode::SelectMode => "ViewportSelectMode".to_string(),
DocumentMode::GuideMode => "ViewportGuideMode".to_string(), // DocumentMode::GuideMode => "ViewportGuideMode".to_string(),
} // }
} // }
} // }
/// SnappingState determines the current individual snapping states /// SnappingState determines the current individual snapping states
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
@@ -250,19 +250,6 @@ impl LayoutHolder for SelectTool {
let disabled = self.tool_data.selected_layers_count < 2; let disabled = self.tool_data.selected_layers_count < 2;
widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance()); widgets.push(Separator::new(SeparatorType::Unrelated).widget_instance());
widgets.extend(self.alignment_widgets(disabled)); widgets.extend(self.alignment_widgets(disabled));
// widgets.push(
// PopoverButton::new()
// .popover_layout(Layout(vec![
// LayoutGroup::Row {
// widgets: vec![TextLabel::new("Align").bold(true).widget_instance()],
// },
// LayoutGroup::Row {
// widgets: vec![TextLabel::new("Coming soon").widget_instance()],
// },
// ]))
// .disabled(disabled)
// .widget_instance(),
// );
// Flip // Flip
let disabled = self.tool_data.selected_layers_count == 0; let disabled = self.tool_data.selected_layers_count == 0;
+29 -34
View File
@@ -5,7 +5,7 @@ use super::tool_messages::*;
use crate::messages::broadcast::BroadcastMessage; use crate::messages::broadcast::BroadcastMessage;
use crate::messages::broadcast::event::EventMessage; use crate::messages::broadcast::event::EventMessage;
use crate::messages::input_mapper::utility_types::input_keyboard::{Key, KeysGroup, LabeledKeyOrMouseMotion, LabeledShortcut, MouseMotion}; use crate::messages::input_mapper::utility_types::input_keyboard::{Key, KeysGroup, LabeledKeyOrMouseMotion, LabeledShortcut, MouseMotion};
use crate::messages::input_mapper::utility_types::macros::{action_shortcut, action_shortcut_manual}; use crate::messages::input_mapper::utility_types::macros::action_shortcut;
use crate::messages::input_mapper::utility_types::misc::ActionShortcut; use crate::messages::input_mapper::utility_types::misc::ActionShortcut;
use crate::messages::layout::utility_types::widget_prelude::*; use crate::messages::layout::utility_types::widget_prelude::*;
use crate::messages::portfolio::document::overlays::utility_types::OverlayProvider; use crate::messages::portfolio::document::overlays::utility_types::OverlayProvider;
@@ -251,7 +251,7 @@ impl LayoutHolder for ToolData {
.tooltip_label(shape.tooltip_label()) .tooltip_label(shape.tooltip_label())
.tooltip_description(shape.tooltip_description()) .tooltip_description(shape.tooltip_description())
.tooltip_shortcut(action_shortcut!(tool_type_to_activate_tool_message(shape.tool_type()))), .tooltip_shortcut(action_shortcut!(tool_type_to_activate_tool_message(shape.tool_type()))),
ToolAvailability::ComingSoon(tool) => tool.clone(), // ToolAvailability::ComingSoon(tool) => tool.clone(),
} }
}) })
.collect::<Vec<_>>() .collect::<Vec<_>>()
@@ -259,8 +259,6 @@ impl LayoutHolder for ToolData {
.flat_map(|group| { .flat_map(|group| {
let separator = std::iter::once(Separator::new(SeparatorType::Section).direction(SeparatorDirection::Vertical).widget_instance()); let separator = std::iter::once(Separator::new(SeparatorType::Section).direction(SeparatorDirection::Vertical).widget_instance());
let buttons = group.into_iter().map(|ToolEntry { tooltip_label, tooltip_description, tooltip_shortcut, tool_type, icon_name }| { let buttons = group.into_iter().map(|ToolEntry { tooltip_label, tooltip_description, tooltip_shortcut, tool_type, icon_name }| {
let coming_soon = tooltip_description.contains("Coming soon.");
IconButton::new(icon_name, 32) IconButton::new(icon_name, 32)
.disabled(false) .disabled(false)
.active(match tool_type { .active(match tool_type {
@@ -276,9 +274,8 @@ impl LayoutHolder for ToolData {
ToolType::Rectangle => ToolMessage::ActivateToolShapeRectangle.into(), ToolType::Rectangle => ToolMessage::ActivateToolShapeRectangle.into(),
ToolType::Ellipse => ToolMessage::ActivateToolShapeEllipse.into(), ToolType::Ellipse => ToolMessage::ActivateToolShapeEllipse.into(),
ToolType::Shape => ToolMessage::ActivateToolShape.into(), ToolType::Shape => ToolMessage::ActivateToolShape.into(),
_ => { _ => ToolMessage::ActivateTool { tool_type }.into(),
if !coming_soon { (ToolMessage::ActivateTool { tool_type }).into() } else { (DialogMessage::RequestComingSoonDialog { issue: None }).into() } // _ => if !tooltip_description.contains("Coming soon.") { ToolMessage::ActivateTool { tool_type }.into() } else { Message::NoOp },
}
} }
}) })
.widget_instance() .widget_instance()
@@ -324,7 +321,7 @@ impl Default for ToolFsmState {
.filter_map(|tool| match tool { .filter_map(|tool| match tool {
ToolAvailability::Available(tool) => Some((tool.tool_type(), tool)), ToolAvailability::Available(tool) => Some((tool.tool_type(), tool)),
ToolAvailability::AvailableAsShape(_) => None, ToolAvailability::AvailableAsShape(_) => None,
ToolAvailability::ComingSoon(_) => None, // ToolAvailability::ComingSoon(_) => None,
}) })
.collect(), .collect(),
}, },
@@ -391,7 +388,7 @@ impl ToolType {
enum ToolAvailability { enum ToolAvailability {
Available(Box<Tool>), Available(Box<Tool>),
AvailableAsShape(ShapeType), AvailableAsShape(ShapeType),
ComingSoon(ToolEntry), // ComingSoon(ToolEntry),
} }
/// List of all the tools in their conventional ordering and grouping. /// List of all the tools in their conventional ordering and grouping.
@@ -421,31 +418,29 @@ fn list_tools_in_groups() -> Vec<Vec<ToolAvailability>> {
vec![ vec![
// Raster tool group // Raster tool group
ToolAvailability::Available(Box::<brush_tool::BrushTool>::default()), ToolAvailability::Available(Box::<brush_tool::BrushTool>::default()),
ToolAvailability::ComingSoon( // ToolAvailability::ComingSoon(
ToolEntry::new(ToolType::Heal, "RasterHealTool") // ToolEntry::new(ToolType::Heal, "RasterHealTool")
.tooltip_label("Heal Tool") // .tooltip_label("Heal Tool")
.tooltip_description("Coming soon.") // .tooltip_shortcut(action_shortcut_manual!(Key::KeyJ)),
.tooltip_shortcut(action_shortcut_manual!(Key::KeyJ)), // ),
), // ToolAvailability::ComingSoon(
ToolAvailability::ComingSoon( // ToolEntry::new(ToolType::Clone, "RasterCloneTool")
ToolEntry::new(ToolType::Clone, "RasterCloneTool") // .tooltip_label("Clone Tool")
.tooltip_label("Clone Tool") // .tooltip_shortcut(action_shortcut_manual!(Key::KeyC)),
.tooltip_description("Coming soon.") // ),
.tooltip_shortcut(action_shortcut_manual!(Key::KeyC)), // ToolAvailability::ComingSoon(ToolEntry::new(ToolType::Patch, "RasterPatchTool")
), // .tooltip_label("Patch Tool"),
ToolAvailability::ComingSoon(ToolEntry::new(ToolType::Patch, "RasterPatchTool").tooltip_label("Patch Tool").tooltip_description("Coming soon.")), // ),
ToolAvailability::ComingSoon( // ToolAvailability::ComingSoon(
ToolEntry::new(ToolType::Detail, "RasterDetailTool") // ToolEntry::new(ToolType::Detail, "RasterDetailTool")
.tooltip_label("Detail Tool") // .tooltip_label("Detail Tool")
.tooltip_description("Coming soon.") // .tooltip_shortcut(action_shortcut_manual!(Key::KeyD)),
.tooltip_shortcut(action_shortcut_manual!(Key::KeyD)), // ),
), // ToolAvailability::ComingSoon(
ToolAvailability::ComingSoon( // ToolEntry::new(ToolType::Relight, "RasterRelightTool")
ToolEntry::new(ToolType::Relight, "RasterRelightTool") // .tooltip_label("Relight Tool")
.tooltip_label("Relight Tool") // .tooltip_shortcut(action_shortcut_manual!(Key::KeyO)),
.tooltip_description("Coming soon.") // ),
.tooltip_shortcut(action_shortcut_manual!(Key::KeyO)),
),
], ],
] ]
} }
@@ -1,7 +1,6 @@
<script lang="ts"> <script lang="ts">
import { onDestroy, createEventDispatcher, getContext } from "svelte"; import { onDestroy, createEventDispatcher } from "svelte";
import type { Editor } from "@graphite/editor";
import type { HSV, RGB, FillChoice } from "@graphite/messages"; import type { HSV, RGB, FillChoice } from "@graphite/messages";
import type { MenuDirection } from "@graphite/messages"; import type { MenuDirection } from "@graphite/messages";
import { Color, contrastingOutlineFactor, Gradient } from "@graphite/messages"; import { Color, contrastingOutlineFactor, Gradient } from "@graphite/messages";
@@ -40,8 +39,6 @@
["Magenta", "#ff00ff", "#696969"], ["Magenta", "#ff00ff", "#696969"],
]; ];
const editor = getContext<Editor>("editor");
const dispatch = createEventDispatcher<{ colorOrGradient: FillChoice; startHistoryTransaction: undefined }>(); const dispatch = createEventDispatcher<{ colorOrGradient: FillChoice; startHistoryTransaction: undefined }>();
export let colorOrGradient: FillChoice; export let colorOrGradient: FillChoice;
@@ -378,13 +375,14 @@
oldIsNone = none; oldIsNone = none;
} }
async function activateEyedropperSample() { // TODO: Replace this temporary usage of the browser eyedropper API, that only works in Chromium-based browsers, with the custom color sampler system used by the Eyedropper tool
// TODO: Replace this temporary solution that only works in Chromium-based browsers with the custom color sampler used by the Eyedropper tool function eyedropperSupported(): boolean {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
if (!(window as any).EyeDropper) { return Boolean((window as any).EyeDropper);
editor.handle.eyedropperSampleForColorPicker(); }
return;
} async function activateEyedropperSample() {
if (!eyedropperSupported()) return;
try { try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -451,7 +449,7 @@
<LayoutCol <LayoutCol
class="hue-picker" class="hue-picker"
data-tooltip-label="Hue" data-tooltip-label="Hue"
data-tooltip-description={"The shade along the spectrum of the rainbow." + (disabled ? "\n\nDisabled (read-only)." : "")} data-tooltip-description={`The shade along the spectrum of the rainbow.${disabled ? "\n\nDisabled (read-only)." : ""}`}
on:pointerdown={onPointerDown} on:pointerdown={onPointerDown}
data-hue-picker data-hue-picker
> >
@@ -462,7 +460,7 @@
<LayoutCol <LayoutCol
class="alpha-picker" class="alpha-picker"
data-tooltip-label="Alpha" data-tooltip-label="Alpha"
data-tooltip-description={"The level of translucency." + (disabled ? "\n\nDisabled (read-only)." : "")} data-tooltip-description={`The level of translucency.${disabled ? "\n\nDisabled (read-only)." : ""}`}
on:pointerdown={onPointerDown} on:pointerdown={onPointerDown}
data-alpha-picker data-alpha-picker
> >
@@ -526,7 +524,7 @@
<LayoutRow> <LayoutRow>
<TextLabel <TextLabel
tooltipLabel="Hex Color Code" tooltipLabel="Hex Color Code"
tooltipDescription={"Color code in hexadecimal format. 6 digits if opaque, 8 with alpha.\nAccepts input of CSS color values including named colors."}>Hex</TextLabel tooltipDescription="Color code in hexadecimal format. 6 digits if opaque, 8 with alpha.\nAccepts input of CSS color values including named colors.">Hex</TextLabel
> >
<Separator type="Related" /> <Separator type="Related" />
<LayoutRow> <LayoutRow>
@@ -539,7 +537,7 @@
}} }}
centered={true} centered={true}
tooltipLabel="Hex Color Code" tooltipLabel="Hex Color Code"
tooltipDescription={"Color code in hexadecimal format. 6 digits if opaque, 8 with alpha.\nAccepts input of CSS color values including named colors."} tooltipDescription="Color code in hexadecimal format. 6 digits if opaque, 8 with alpha.\nAccepts input of CSS color values including named colors."
bind:this={hexCodeInputWidget} bind:this={hexCodeInputWidget}
/> />
</LayoutRow> </LayoutRow>
@@ -677,8 +675,10 @@
/> />
{/each} {/each}
</button> </button>
<Separator type="Related" /> {#if eyedropperSupported()}
<IconButton icon="Eyedropper" size={24} {disabled} action={activateEyedropperSample} tooltipLabel="Eyedropper" tooltipDescription="Sample a pixel color from the document." /> <Separator type="Related" />
<IconButton icon="Eyedropper" size={24} {disabled} action={activateEyedropperSample} tooltipLabel="Eyedropper" tooltipDescription="Sample a pixel color from the document." />
{/if}
</LayoutRow> </LayoutRow>
</LayoutCol> </LayoutCol>
</LayoutRow> </LayoutRow>
@@ -506,7 +506,6 @@
<LayoutCol class="document" on:dragover={(e) => e.preventDefault()} on:drop={dropFile}> <LayoutCol class="document" on:dragover={(e) => e.preventDefault()} on:drop={dropFile}>
<LayoutRow class="control-bar" classes={{ "for-graph": $document.graphViewOverlayOpen }} scrollableX={true}> <LayoutRow class="control-bar" classes={{ "for-graph": $document.graphViewOverlayOpen }} scrollableX={true}>
{#if !$document.graphViewOverlayOpen} {#if !$document.graphViewOverlayOpen}
<WidgetLayout layout={$document.documentModeLayout} layoutTarget="DocumentMode" />
<WidgetLayout layout={$document.toolOptionsLayout} layoutTarget="ToolOptions" /> <WidgetLayout layout={$document.toolOptionsLayout} layoutTarget="ToolOptions" />
<LayoutRow class="spacer" /> <LayoutRow class="spacer" />
<WidgetLayout layout={$document.documentBarLayout} layoutTarget="DocumentBar" /> <WidgetLayout layout={$document.documentBarLayout} layoutTarget="DocumentBar" />
@@ -698,14 +697,14 @@
.icon-button { .icon-button {
margin: 0; margin: 0;
&[data-tooltip-description^="Coming soon."] { // &[data-tooltip-description^="Coming soon."] {
opacity: 0.25; // opacity: 0.25;
transition: opacity 0.1s; // transition: opacity 0.1s;
&:hover { // &:hover {
opacity: 1; // opacity: 1;
} // }
} // }
&:not(.active) { &:not(.active) {
.color-general { .color-general {
-4
View File
@@ -1496,7 +1496,6 @@ export type LayoutTarget =
| "DialogColumn1" | "DialogColumn1"
| "DialogColumn2" | "DialogColumn2"
| "DocumentBar" | "DocumentBar"
| "DocumentMode"
| "LayersPanelBottomBar" | "LayersPanelBottomBar"
| "LayersPanelControlLeftBar" | "LayersPanelControlLeftBar"
| "LayersPanelControlRightBar" | "LayersPanelControlRightBar"
@@ -1646,8 +1645,6 @@ export class UpdateDialogColumn2 extends WidgetDiffUpdate {}
export class UpdateDocumentBarLayout extends WidgetDiffUpdate {} export class UpdateDocumentBarLayout extends WidgetDiffUpdate {}
export class UpdateDocumentModeLayout extends WidgetDiffUpdate {}
export class UpdateLayersPanelControlBarLeftLayout extends WidgetDiffUpdate {} export class UpdateLayersPanelControlBarLeftLayout extends WidgetDiffUpdate {}
export class UpdateLayersPanelControlBarRightLayout extends WidgetDiffUpdate {} export class UpdateLayersPanelControlBarRightLayout extends WidgetDiffUpdate {}
@@ -1721,7 +1718,6 @@ export const messageMakers: Record<string, MessageMaker> = {
UpdateDocumentBarLayout, UpdateDocumentBarLayout,
UpdateDocumentLayerDetails, UpdateDocumentLayerDetails,
UpdateDocumentLayerStructureJs, UpdateDocumentLayerStructureJs,
UpdateDocumentModeLayout,
UpdateDocumentRulers, UpdateDocumentRulers,
UpdateDocumentScrollbars, UpdateDocumentScrollbars,
UpdateExportReorderIndex, UpdateExportReorderIndex,
-10
View File
@@ -6,7 +6,6 @@ import { type Editor } from "@graphite/editor";
import { import {
patchLayout, patchLayout,
UpdateDocumentBarLayout, UpdateDocumentBarLayout,
UpdateDocumentModeLayout,
UpdateToolOptionsLayout, UpdateToolOptionsLayout,
UpdateToolShelfLayout, UpdateToolShelfLayout,
UpdateWorkingColorsLayout, UpdateWorkingColorsLayout,
@@ -19,7 +18,6 @@ import type { Layout } from "@graphite/messages";
export function createDocumentState(editor: Editor) { export function createDocumentState(editor: Editor) {
const state = writable({ const state = writable({
// Layouts // Layouts
documentModeLayout: [] as Layout,
toolOptionsLayout: [] as Layout, toolOptionsLayout: [] as Layout,
documentBarLayout: [] as Layout, documentBarLayout: [] as Layout,
toolShelfLayout: [] as Layout, toolShelfLayout: [] as Layout,
@@ -38,14 +36,6 @@ export function createDocumentState(editor: Editor) {
return state; return state;
}); });
}); });
editor.subscriptions.subscribeJsMessage(UpdateDocumentModeLayout, async (updateDocumentModeLayout) => {
await tick();
update((state) => {
patchLayout(state.documentModeLayout, updateDocumentModeLayout);
return state;
});
});
editor.subscriptions.subscribeJsMessage(UpdateToolOptionsLayout, async (updateToolOptionsLayout) => { editor.subscriptions.subscribeJsMessage(UpdateToolOptionsLayout, async (updateToolOptionsLayout) => {
await tick(); await tick();
-9
View File
@@ -584,15 +584,6 @@ impl EditorHandle {
Ok(()) Ok(())
} }
/// Begin sampling a pixel color from the document by entering eyedropper sampling mode
#[wasm_bindgen(js_name = eyedropperSampleForColorPicker)]
pub fn eyedropper_sample_for_color_picker(&self) -> Result<(), JsValue> {
let message = DialogMessage::RequestComingSoonDialog { issue: Some(832) };
self.dispatch(message);
Ok(())
}
/// Update primary color with values on a scale from 0 to 1. /// Update primary color with values on a scale from 0 to 1.
#[wasm_bindgen(js_name = updatePrimaryColor)] #[wasm_bindgen(js_name = updatePrimaryColor)]
pub fn update_primary_color(&self, red: f32, green: f32, blue: f32, alpha: f32) -> Result<(), JsValue> { pub fn update_primary_color(&self, red: f32, green: f32, blue: f32, alpha: f32) -> Result<(), JsValue> {