parent
b84e647f40
commit
45a1e144a8
|
|
@ -190,10 +190,6 @@ pub fn default_mapping() -> Mapping {
|
|||
standard!(KeyDown(KeyS); modifiers=[KeyControl], action_dispatch=DocumentMessage::SaveDocument),
|
||||
mac_only!(KeyDown(KeyS); modifiers=[KeyCommand], action_dispatch=DocumentMessage::SaveDocument),
|
||||
),
|
||||
entry_multiplatform!(
|
||||
standard!(KeyDown(Key0); modifiers=[KeyControl], action_dispatch=DocumentMessage::ZoomCanvasToFitAll),
|
||||
mac_only!(KeyDown(Key0); modifiers=[KeyCommand], action_dispatch=DocumentMessage::ZoomCanvasToFitAll),
|
||||
),
|
||||
entry_multiplatform!(
|
||||
standard!(KeyDown(KeyD); modifiers=[KeyControl], action_dispatch=DocumentMessage::DuplicateSelectedLayers),
|
||||
mac_only!(KeyDown(KeyD); modifiers=[KeyCommand], action_dispatch=DocumentMessage::DuplicateSelectedLayers),
|
||||
|
|
@ -210,6 +206,18 @@ pub fn default_mapping() -> Mapping {
|
|||
standard!(KeyDown(KeyN); modifiers=[KeyControl, KeyShift], action_dispatch=DocumentMessage::CreateEmptyFolder { container_path: vec![] }),
|
||||
mac_only!(KeyDown(KeyN); modifiers=[KeyCommand, KeyShift], action_dispatch=DocumentMessage::CreateEmptyFolder { container_path: vec![] }),
|
||||
),
|
||||
entry_multiplatform!(
|
||||
standard!(KeyDown(Key0); modifiers=[KeyControl], action_dispatch=DocumentMessage::ZoomCanvasToFitAll),
|
||||
mac_only!(KeyDown(Key0); modifiers=[KeyCommand], action_dispatch=DocumentMessage::ZoomCanvasToFitAll),
|
||||
),
|
||||
entry_multiplatform!(
|
||||
standard!(KeyDown(Key1); modifiers=[KeyControl], action_dispatch=DocumentMessage::ZoomCanvasTo100Percent),
|
||||
mac_only!(KeyDown(Key1); modifiers=[KeyCommand], action_dispatch=DocumentMessage::ZoomCanvasTo100Percent),
|
||||
),
|
||||
entry_multiplatform!(
|
||||
standard!(KeyDown(Key2); modifiers=[KeyControl], action_dispatch=DocumentMessage::ZoomCanvasTo200Percent),
|
||||
mac_only!(KeyDown(Key2); modifiers=[KeyCommand], action_dispatch=DocumentMessage::ZoomCanvasTo200Percent),
|
||||
),
|
||||
entry_multiplatform!(
|
||||
standard!(KeyDown(KeyLeftBracket); modifiers=[KeyControl, KeyShift], action_dispatch=DocumentMessage::SelectedLayersLowerToBack),
|
||||
mac_only!(KeyDown(KeyLeftBracket); modifiers=[KeyCommand, KeyShift], action_dispatch=DocumentMessage::SelectedLayersLowerToBack),
|
||||
|
|
@ -285,14 +293,6 @@ pub fn default_mapping() -> Mapping {
|
|||
standard!(KeyDown(KeyMinus); modifiers=[KeyControl], action_dispatch=MovementMessage::DecreaseCanvasZoom { center_on_mouse: false }),
|
||||
mac_only!(KeyDown(KeyMinus); modifiers=[KeyCommand], action_dispatch=MovementMessage::DecreaseCanvasZoom { center_on_mouse: false }),
|
||||
),
|
||||
entry_multiplatform!(
|
||||
standard!(KeyDown(Key1); modifiers=[KeyControl], action_dispatch=MovementMessage::SetCanvasZoom { zoom_factor: 1. }),
|
||||
mac_only!(KeyDown(Key1); modifiers=[KeyCommand], action_dispatch=MovementMessage::SetCanvasZoom { zoom_factor: 1. }),
|
||||
),
|
||||
entry_multiplatform!(
|
||||
standard!(KeyDown(Key2); modifiers=[KeyControl], action_dispatch=MovementMessage::SetCanvasZoom { zoom_factor: 2. }),
|
||||
mac_only!(KeyDown(Key2); modifiers=[KeyCommand], action_dispatch=MovementMessage::SetCanvasZoom { zoom_factor: 2. }),
|
||||
),
|
||||
entry!(WheelScroll; modifiers=[KeyControl], action_dispatch=MovementMessage::WheelCanvasZoom),
|
||||
entry!(WheelScroll; modifiers=[KeyShift], action_dispatch=MovementMessage::WheelCanvasTranslate { use_y_as_x: true }),
|
||||
entry!(WheelScroll; action_dispatch=MovementMessage::WheelCanvasTranslate { use_y_as_x: false }),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ use crate::messages::input_mapper::utility_types::input_keyboard::{Key, Modifier
|
|||
use crate::messages::input_mapper::utility_types::input_mouse::{EditorMouseState, ViewportBounds};
|
||||
use crate::messages::prelude::*;
|
||||
|
||||
#[doc(inline)]
|
||||
pub use graphene::DocumentResponse;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ use crate::messages::input_mapper::utility_types::input_mouse::{MouseKeys, Mouse
|
|||
use crate::messages::portfolio::document::utility_types::misc::KeyboardPlatformLayout;
|
||||
use crate::messages::prelude::*;
|
||||
|
||||
#[doc(inline)]
|
||||
pub use graphene::DocumentResponse;
|
||||
|
||||
use glam::DVec2;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ pub enum ArtboardMessage {
|
|||
position: (f64, f64),
|
||||
size: (f64, f64),
|
||||
},
|
||||
ClearArtboards,
|
||||
DeleteArtboard {
|
||||
artboard: LayerId,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -63,6 +63,11 @@ impl MessageHandler<ArtboardMessage, &FontCache> for ArtboardMessageHandler {
|
|||
|
||||
responses.push_back(DocumentMessage::RenderDocument.into());
|
||||
}
|
||||
ClearArtboards => {
|
||||
for &artboard in self.artboard_ids.iter() {
|
||||
responses.push_front(ArtboardMessage::DeleteArtboard { artboard }.into());
|
||||
}
|
||||
}
|
||||
DeleteArtboard { artboard } => {
|
||||
self.artboard_ids.retain(|&id| id != artboard);
|
||||
|
||||
|
|
|
|||
|
|
@ -169,6 +169,8 @@ pub enum DocumentMessage {
|
|||
layer_path: Vec<LayerId>,
|
||||
layer_metadata: LayerMetadata,
|
||||
},
|
||||
ZoomCanvasTo100Percent,
|
||||
ZoomCanvasTo200Percent,
|
||||
ZoomCanvasToFitAll,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -758,6 +758,12 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
|
|||
UpdateLayerMetadata { layer_path, layer_metadata } => {
|
||||
self.layer_metadata.insert(layer_path, layer_metadata);
|
||||
}
|
||||
ZoomCanvasTo100Percent => {
|
||||
responses.push_front(MovementMessage::SetCanvasZoom { zoom_factor: 1. }.into());
|
||||
}
|
||||
ZoomCanvasTo200Percent => {
|
||||
responses.push_front(MovementMessage::SetCanvasZoom { zoom_factor: 2. }.into());
|
||||
}
|
||||
ZoomCanvasToFitAll => {
|
||||
if let Some(bounds) = self.document_bounds(font_cache) {
|
||||
responses.push_back(
|
||||
|
|
@ -785,6 +791,8 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
|
|||
SetSnapping,
|
||||
DebugPrintDocument,
|
||||
ZoomCanvasToFitAll,
|
||||
ZoomCanvasTo100Percent,
|
||||
ZoomCanvasTo200Percent,
|
||||
CreateEmptyFolder,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -267,7 +267,6 @@ impl MessageHandler<MovementMessage, (&Document, &InputPreprocessorMessageHandle
|
|||
TranslateCanvasBegin,
|
||||
RotateCanvasBegin,
|
||||
ZoomCanvasBegin,
|
||||
SetCanvasZoom,
|
||||
SetCanvasRotation,
|
||||
WheelCanvasZoom,
|
||||
IncreaseCanvasZoom,
|
||||
|
|
|
|||
|
|
@ -44,47 +44,6 @@ impl PropertyHolder for MenuBarMessageHandler {
|
|||
action: MenuEntry::create_action(|_| PortfolioMessage::OpenDocument.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Open Recent".into(),
|
||||
shortcut: None,
|
||||
action: MenuEntry::no_action(),
|
||||
icon: None,
|
||||
children: MenuEntryGroups(vec![
|
||||
vec![
|
||||
MenuEntry {
|
||||
label: "Reopen Last Closed".into(),
|
||||
// shortcut: [Key::KeyControl, Key::KeyShift, Key::KeyT],
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Clear Recently Opened".into(),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
],
|
||||
vec![
|
||||
MenuEntry {
|
||||
label: "Some Recent File.gdd".into(),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Another Recent File.gdd".into(),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "An Older File.gdd".into(),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Some Other Older File.gdd".into(),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Yet Another Older File.gdd".into(),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
],
|
||||
]),
|
||||
},
|
||||
],
|
||||
vec![
|
||||
MenuEntry {
|
||||
|
|
@ -100,29 +59,12 @@ impl PropertyHolder for MenuBarMessageHandler {
|
|||
..MenuEntry::default()
|
||||
},
|
||||
],
|
||||
vec![
|
||||
MenuEntry {
|
||||
label: "Save".into(),
|
||||
shortcut: action_keys!(DocumentMessageDiscriminant::SaveDocument),
|
||||
action: MenuEntry::create_action(|_| DocumentMessage::SaveDocument.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Save As…".into(),
|
||||
// shortcut: [Key::KeyControl, Key::KeyShift, Key::KeyS],
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Save All".into(),
|
||||
// shortcut: [Key::KeyControl, Key::KeyAlt, Key::KeyS],
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Auto-Save".into(),
|
||||
icon: Some("CheckboxChecked".into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
],
|
||||
vec![MenuEntry {
|
||||
label: "Save".into(),
|
||||
shortcut: action_keys!(DocumentMessageDiscriminant::SaveDocument),
|
||||
action: MenuEntry::create_action(|_| DocumentMessage::SaveDocument.into()),
|
||||
..MenuEntry::default()
|
||||
}],
|
||||
vec![
|
||||
MenuEntry {
|
||||
label: "Import…".into(),
|
||||
|
|
@ -137,11 +79,6 @@ impl PropertyHolder for MenuBarMessageHandler {
|
|||
..MenuEntry::default()
|
||||
},
|
||||
],
|
||||
vec![MenuEntry {
|
||||
label: "Quit".into(),
|
||||
// shortcut: [Key::KeyControl, Key::KeyQ],
|
||||
..MenuEntry::default()
|
||||
}],
|
||||
]),
|
||||
},
|
||||
MenuColumn {
|
||||
|
|
@ -187,20 +124,49 @@ impl PropertyHolder for MenuBarMessageHandler {
|
|||
},
|
||||
MenuColumn {
|
||||
label: "Layer".into(),
|
||||
children: MenuEntryGroups(vec![vec![
|
||||
MenuEntry {
|
||||
label: "Select All".into(),
|
||||
shortcut: action_keys!(DocumentMessageDiscriminant::SelectAllLayers),
|
||||
action: MenuEntry::create_action(|_| DocumentMessage::SelectAllLayers.into()),
|
||||
children: MenuEntryGroups(vec![
|
||||
vec![
|
||||
MenuEntry {
|
||||
label: "Select All".into(),
|
||||
shortcut: action_keys!(DocumentMessageDiscriminant::SelectAllLayers),
|
||||
action: MenuEntry::create_action(|_| DocumentMessage::SelectAllLayers.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Deselect All".into(),
|
||||
shortcut: action_keys!(DocumentMessageDiscriminant::DeselectAllLayers),
|
||||
action: MenuEntry::create_action(|_| DocumentMessage::DeselectAllLayers.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
],
|
||||
vec![MenuEntry {
|
||||
label: "Delete Selected".into(),
|
||||
icon: Some("Trash".into()),
|
||||
shortcut: action_keys!(DocumentMessageDiscriminant::DeleteSelectedLayers),
|
||||
action: MenuEntry::create_action(|_| DocumentMessage::DeleteSelectedLayers.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Deselect All".into(),
|
||||
shortcut: action_keys!(DocumentMessageDiscriminant::DeselectAllLayers),
|
||||
action: MenuEntry::create_action(|_| DocumentMessage::DeselectAllLayers.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
}],
|
||||
vec![
|
||||
MenuEntry {
|
||||
label: "Grab Selected".into(),
|
||||
shortcut: action_keys!(TransformLayerMessageDiscriminant::BeginGrab),
|
||||
action: MenuEntry::create_action(|_| TransformLayerMessage::BeginGrab.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Rotate Selected".into(),
|
||||
shortcut: action_keys!(TransformLayerMessageDiscriminant::BeginRotate),
|
||||
action: MenuEntry::create_action(|_| TransformLayerMessage::BeginRotate.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Scale Selected".into(),
|
||||
shortcut: action_keys!(TransformLayerMessageDiscriminant::BeginScale),
|
||||
action: MenuEntry::create_action(|_| TransformLayerMessage::BeginScale.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
],
|
||||
vec![MenuEntry {
|
||||
label: "Order".into(),
|
||||
action: MenuEntry::no_action(),
|
||||
children: MenuEntryGroups(vec![vec![
|
||||
|
|
@ -230,23 +196,46 @@ impl PropertyHolder for MenuBarMessageHandler {
|
|||
},
|
||||
]]),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
]]),
|
||||
}],
|
||||
]),
|
||||
},
|
||||
MenuColumn {
|
||||
label: "Document".into(),
|
||||
children: MenuEntryGroups(vec![vec![MenuEntry {
|
||||
label: "Menu entries coming soon".into(),
|
||||
label: "Clear Artboards".into(),
|
||||
action: MenuEntry::create_action(|_| ArtboardMessage::ClearArtboards.into()),
|
||||
..MenuEntry::default()
|
||||
}]]),
|
||||
},
|
||||
MenuColumn {
|
||||
label: "View".into(),
|
||||
children: MenuEntryGroups(vec![vec![MenuEntry {
|
||||
label: "Show/Hide Node Graph (In Development)".into(),
|
||||
action: MenuEntry::create_action(|_| WorkspaceMessage::NodeGraphToggleVisibility.into()),
|
||||
..MenuEntry::default()
|
||||
}]]),
|
||||
children: MenuEntryGroups(vec![
|
||||
vec![
|
||||
MenuEntry {
|
||||
label: "Zoom to Fit".into(),
|
||||
shortcut: action_keys!(DocumentMessageDiscriminant::ZoomCanvasToFitAll),
|
||||
action: MenuEntry::create_action(|_| DocumentMessage::ZoomCanvasToFitAll.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Zoom to 100%".into(),
|
||||
shortcut: action_keys!(DocumentMessageDiscriminant::ZoomCanvasTo100Percent),
|
||||
action: MenuEntry::create_action(|_| DocumentMessage::ZoomCanvasTo100Percent.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
MenuEntry {
|
||||
label: "Zoom to 200%".into(),
|
||||
shortcut: action_keys!(DocumentMessageDiscriminant::ZoomCanvasTo200Percent),
|
||||
action: MenuEntry::create_action(|_| DocumentMessage::ZoomCanvasTo200Percent.into()),
|
||||
..MenuEntry::default()
|
||||
},
|
||||
],
|
||||
vec![MenuEntry {
|
||||
label: "Node Graph (In Development)".into(),
|
||||
action: MenuEntry::create_action(|_| WorkspaceMessage::NodeGraphToggleVisibility.into()),
|
||||
..MenuEntry::default()
|
||||
}],
|
||||
]),
|
||||
},
|
||||
MenuColumn {
|
||||
label: "Help".into(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue