Polishing: standardize binding JS resize event (fixes non-integer AA rendering); remove "X" to delete; cleanup

This commit is contained in:
Keavon Chambers
2022-02-10 02:29:45 -08:00
parent a4d3c343a0
commit 77dc125095
10 changed files with 63 additions and 49 deletions

View File

@@ -25,9 +25,9 @@ struct DispatcherMessageHandlers {
tool_message_handler: ToolMessageHandler,
}
// For optimization, these are messages guaranteed to be redundant when repeated.
// The last occurrence of the message in the message queue is sufficient to ensure correct behavior.
// In addition, these messages do not change any state in the backend (aside from caches).
/// For optimization, these are messages guaranteed to be redundant when repeated.
/// The last occurrence of the message in the message queue is sufficient to ensure correct behavior.
/// In addition, these messages do not change any state in the backend (aside from caches).
const SIDE_EFFECT_FREE_MESSAGES: &[MessageDiscriminant] = &[
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::RenderDocument)),
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::Overlays(OverlaysMessageDiscriminant::Rerender))),

View File

@@ -29,6 +29,7 @@ pub enum FrontendMessage {
TriggerIndexedDbRemoveDocument { document_id: u64 },
TriggerIndexedDbWriteDocument { document: String, details: FrontendDocumentDetails, version: String },
TriggerTextCommit,
TriggerViewportResize,
// Update prefix: give the frontend a new value or state for it to use
UpdateActiveDocument { document_id: u64 },

View File

@@ -23,7 +23,7 @@ impl Default for Mapping {
use Key::*;
// WARNING!
// If a new mapping isn't being handled (and perhaps another lower-precedence one is instead), make sure to advertise
// If a new mapping you added here isn't working (and perhaps another lower-precedence one is instead), make sure to advertise
// it as an available action in the respective message handler file (such as the bottom of `document_message_handler.rs`).
let mappings = mapping![
@@ -145,7 +145,6 @@ impl Default for Mapping {
entry! {action=DocumentMessage::SelectAllLayers, key_down=KeyA, modifiers=[KeyControl]},
entry! {action=DocumentMessage::CreateEmptyFolder { container_path: vec![] }, key_down=KeyN, modifiers=[KeyControl, KeyShift]},
entry! {action=DocumentMessage::DeleteSelectedLayers, key_down=KeyDelete},
entry! {action=DocumentMessage::DeleteSelectedLayers, key_down=KeyX},
entry! {action=DocumentMessage::DeleteSelectedLayers, key_down=KeyBackspace},
entry! {action=DocumentMessage::ExportDocument, key_down=KeyE, modifiers=[KeyControl]},
entry! {action=DocumentMessage::SaveDocument, key_down=KeyS, modifiers=[KeyControl]},

View File

@@ -47,6 +47,7 @@ impl MessageHandler<InputPreprocessorMessage, ()> for InputPreprocessorMessageHa
)
.into(),
);
responses.push_back(FrontendMessage::TriggerViewportResize.into());
}
}
InputPreprocessorMessage::DoubleClick { editor_mouse_state, modifier_keys } => {

View File

@@ -10,9 +10,9 @@ use crate::viewport_tools::snapping::SnapHandler;
use crate::viewport_tools::tool::{DocumentToolData, Fsm, ToolActionHandlerData};
use crate::viewport_tools::vector_editor::shape_editor::ShapeEditor;
use glam::DVec2;
use graphene::intersection::Quad;
use glam::DVec2;
use serde::{Deserialize, Serialize};
#[derive(Default)]