mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Add the SVG Preview render mode in place of the Vello option in the preferences (#3797)
* Remove Vello from preferences * Add the Render Mode: SVG Preview radio button * Remove SVG outline renderer * Add a tooltip explaination when disabled in unsupported browsers * Fix Eyedropper tool to support Outline render mode * Use #[allow(clippy::too_many_arguments)] instead of tuple * Rerun nodegraph when max render area is changed --------- Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
@@ -336,27 +336,13 @@ pub type WasmSurfaceHandle = SurfaceHandle<wgpu_executor::Window>;
|
||||
#[cfg(feature = "wgpu")]
|
||||
pub type WasmSurfaceHandleFrame = graphene_application_io::SurfaceHandleFrame<wgpu_executor::Window>;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, specta::Type, serde::Serialize, serde::Deserialize)]
|
||||
pub enum VelloPreference {
|
||||
Auto,
|
||||
Disabled,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Hash, specta::Type, serde::Serialize, serde::Deserialize)]
|
||||
pub struct EditorPreferences {
|
||||
pub vello_preference: VelloPreference,
|
||||
/// Maximum render region size in pixels along one dimension of the square area.
|
||||
pub max_render_region_size: u32,
|
||||
}
|
||||
|
||||
impl graphene_application_io::GetEditorPreferences for EditorPreferences {
|
||||
fn use_vello(&self) -> bool {
|
||||
match self.vello_preference {
|
||||
VelloPreference::Auto => wgpu_available().unwrap_or(false),
|
||||
VelloPreference::Disabled => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn max_render_region_area(&self) -> u32 {
|
||||
let size = self.max_render_region_size.min(u32::MAX.isqrt());
|
||||
size.pow(2)
|
||||
@@ -365,10 +351,7 @@ impl graphene_application_io::GetEditorPreferences for EditorPreferences {
|
||||
|
||||
impl Default for EditorPreferences {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
vello_preference: VelloPreference::Auto,
|
||||
max_render_region_size: 1280,
|
||||
}
|
||||
Self { max_render_region_size: 1280 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user