mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 08:58:12 +08:00
Add 'Zoom with Scroll' input navigation scheme to preferences (#1021)
* Add use_scroll_as_zoom field to preference handler
* Add {Create,Delete}Mapping variants to message
* Revert "Add {Create,Delete}Mapping variants to message"
This reverts commit 0ba74754c9fb0c78d0b590c96e1d4fe2cfdd13e7.
* Revert "Add use_scroll_as_zoom field to preference handler"
This reverts commit d30f7c9edfa6d6e156939ca07f4db81f288975fd.
* Add basic scroll_as_zoom mapping
* Create overengineered mapping patch abstraction
* Add (for now passthrough) input layout manager
* Actually handle ModifyLayout messages (untested)
* Add backend preferences <-> layout manager comms
* Add scroll-as-zoom to actual preferences UI
* Rename LayoutManager -> KeyMapping
* Add Input section to preferences and title case
* Add scrollAsZoom frontend handling code (untested)
* Handle frontend <-> preferences comms
* (broken) Move scrollAsZoom persistence into state
* Fix scrollAsZoom having no effect on node graph
* Remove debugging helpers
* Fix confusion between horizontal and vertical
* Rename feature
* Move new message handler into folder
---------
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
parent
c2234ce3fe
commit
7a52e50a94
@@ -1,3 +1,4 @@
|
||||
use crate::messages::input_mapper::key_mapping::MappingVariant;
|
||||
use crate::messages::prelude::*;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -6,6 +7,7 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct PreferencesMessageHandler {
|
||||
pub imaginate_server_hostname: String,
|
||||
pub imaginate_refresh_frequency: f64,
|
||||
pub zoom_with_scroll: bool,
|
||||
}
|
||||
|
||||
impl Default for PreferencesMessageHandler {
|
||||
@@ -13,6 +15,7 @@ impl Default for PreferencesMessageHandler {
|
||||
Self {
|
||||
imaginate_server_hostname: "http://localhost:7860/".into(),
|
||||
imaginate_refresh_frequency: 1.,
|
||||
zoom_with_scroll: matches!(MappingVariant::default(), MappingVariant::ZoomWithScroll),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,6 +56,16 @@ impl MessageHandler<PreferencesMessage, ()> for PreferencesMessageHandler {
|
||||
self.imaginate_server_hostname = hostname;
|
||||
responses.push_back(PortfolioMessage::ImaginateCheckServerStatus.into());
|
||||
}
|
||||
PreferencesMessage::ModifyLayout { zoom_with_scroll } => {
|
||||
self.zoom_with_scroll = zoom_with_scroll;
|
||||
|
||||
let variant = match zoom_with_scroll {
|
||||
false => MappingVariant::Default,
|
||||
true => MappingVariant::ZoomWithScroll,
|
||||
};
|
||||
responses.push_back(KeyMappingMessage::ModifyMapping(variant).into());
|
||||
responses.push_back(FrontendMessage::UpdateZoomWithScroll { zoom_with_scroll }.into());
|
||||
}
|
||||
}
|
||||
|
||||
responses.push_back(FrontendMessage::TriggerSavePreferences { preferences: self.clone() }.into());
|
||||
|
||||
Reference in New Issue
Block a user