Merge branch 'master' into fix-stroke-alignment-outside

This commit is contained in:
mTvare 2025-08-19 08:08:07 +05:30 committed by GitHub
commit ac93b41ad9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 17 additions and 40 deletions

11
Cargo.lock generated
View file

@ -2000,7 +2000,6 @@ dependencies = [
"dyn-any",
"glam",
"graphene-core",
"kurbo",
"log",
"node-macro",
"path-bool",
@ -2035,10 +2034,7 @@ name = "graphene-std"
version = "0.1.0"
dependencies = [
"base64 0.22.1",
"bytemuck",
"dyn-any",
"fastnoise-lite",
"futures",
"glam",
"graph-craft",
"graphene-application-io",
@ -2050,10 +2046,7 @@ dependencies = [
"graphene-svg-renderer",
"image",
"log",
"ndarray",
"node-macro",
"rand 0.9.1",
"rand_chacha 0.9.0",
"reqwest",
"tokio",
"vello",
@ -2112,7 +2105,6 @@ version = "0.0.0"
dependencies = [
"base64 0.22.1",
"bitflags 2.9.1",
"bytemuck",
"derivative",
"dyn-any",
"env_logger",
@ -2128,18 +2120,15 @@ dependencies = [
"num_enum",
"once_cell",
"preprocessor",
"ron",
"serde",
"serde_json",
"specta",
"spin",
"thiserror 2.0.12",
"tokio",
"tracing",
"usvg",
"vello",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"wgpu-executor",
]

View file

@ -85,7 +85,6 @@ thiserror = "2"
anyhow = "1.0"
proc-macro2 = { version = "1", features = ["span-locations"] }
quote = "1.0"
axum = "0.8"
chrono = "0.4"
ron = "0.8"
fastnoise-lite = "1.1"

View file

@ -12,11 +12,11 @@ license = "Apache-2.0"
[features]
default = ["wasm"]
wasm = ["wasm-bindgen", "graphene-std/wasm", "wasm-bindgen-futures"]
wasm = ["wasm-bindgen", "graphene-std/wasm"]
gpu = ["interpreted-executor/gpu", "wgpu-executor"]
resvg = ["graphene-std/resvg"]
vello = ["graphene-std/vello", "resvg"]
ron = ["dep:ron"]
ron = []
[dependencies]
# Local dependencies
@ -43,9 +43,7 @@ num_enum = { workspace = true }
usvg = { workspace = true }
once_cell = { workspace = true }
web-sys = { workspace = true }
bytemuck = { workspace = true }
vello = { workspace = true }
tracing = { workspace = true }
base64 = { workspace = true }
# Required dependencies
@ -56,8 +54,6 @@ wgpu-executor = { workspace = true, optional = true }
# Optional workspace dependencies
wasm-bindgen = { workspace = true, optional = true }
wasm-bindgen-futures = { workspace = true, optional = true }
ron = { workspace = true, optional = true }
[dev-dependencies]
# Workspace dependencies

View file

@ -202,6 +202,7 @@ impl core::hash::Hash for OverlayContext {
}
impl OverlayContext {
#[allow(dead_code)]
pub(super) fn new(size: DVec2, device_pixel_ratio: f64, visibility_settings: OverlaysVisibilitySettings) -> Self {
Self {
internal: Arc::new(Mutex::new(OverlayContextInternal::new(size, device_pixel_ratio, visibility_settings))),

View file

@ -33,3 +33,6 @@ graphene-core = { workspace = true }
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(target_arch, values("spirv"))',
] }
[package.metadata.cargo-shear]
ignored = ["graphene-core"]

View file

@ -10,18 +10,6 @@ pub trait Identifier: Sized + Clone + PartialEq + Hash + 'static {
fn new() -> Self;
}
/// An empty id type for use in tests
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
#[cfg(test)]
pub(crate) struct EmptyId;
#[cfg(test)]
impl Identifier for EmptyId {
fn new() -> Self {
Self
}
}
/// Structure used to represent a single anchor with up to two optional associated handles along a `Subpath`
#[derive(Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]

View file

@ -371,6 +371,16 @@ impl Stroke {
self.weight
}
/// Get the effective stroke weight.
pub fn effective_width(&self) -> f64 {
self.weight
* match self.align {
StrokeAlign::Center => 1.,
StrokeAlign::Inside => 0.,
StrokeAlign::Outside => 2.,
}
}
pub fn dash_lengths(&self) -> String {
if self.dash_lengths.is_empty() {
"none".to_string()

View file

@ -16,4 +16,3 @@ specta = { workspace = true }
log = { workspace = true }
path-bool = { workspace = true }
serde = { workspace = true }
kurbo = { workspace = true }

View file

@ -36,15 +36,10 @@ graphene-raster-nodes = { workspace = true }
graphene-brush = { workspace = true }
# Workspace dependencies
fastnoise-lite = { workspace = true }
log = { workspace = true }
glam = { workspace = true }
node-macro = { workspace = true }
reqwest = { workspace = true }
futures = { workspace = true }
rand_chacha = { workspace = true }
rand = { workspace = true }
bytemuck = { workspace = true }
image = { workspace = true }
base64 = { workspace = true }
@ -65,8 +60,5 @@ web-sys = { workspace = true, optional = true, features = [
"ImageBitmapRenderingContext",
] }
# Required dependencies
ndarray = "0.16.1"
[dev-dependencies]
tokio = { workspace = true }

View file

@ -1074,7 +1074,7 @@ impl Render for Table<Vector> {
let vector = row.element;
if let Some(element_id) = element_id {
let stroke_width = vector.style.stroke().as_ref().map_or(0., Stroke::weight);
let stroke_width = vector.style.stroke().as_ref().map_or(0., Stroke::effective_width);
let filled = vector.style.fill() != &Fill::None;
let fill = |mut subpath: Subpath<_>| {
if filled {