mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 06:38:03 +08:00
Improve rendered SVG output syntax for better compatibility and terseness (#1880)
* Improve rendered SVG output syntax for better compatibility and terseness * Fix CI failing on boolean operations without wasm32? * Attempt 2
This commit is contained in:
@@ -279,6 +279,7 @@ pub fn convert_usvg_path(path: &usvg::Path) -> Vec<Subpath<PointId>> {
|
||||
subpaths
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
#[wasm_bindgen(module = "/../../frontend/src/utility-functions/computational-geometry.ts")]
|
||||
extern "C" {
|
||||
#[wasm_bindgen(js_name = booleanUnion)]
|
||||
@@ -290,3 +291,19 @@ extern "C" {
|
||||
#[wasm_bindgen(js_name = booleanDifference)]
|
||||
fn boolean_difference(path1: String, path2: String) -> String;
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn boolean_union(_path1: String, _path2: String) -> String {
|
||||
String::from("M0,0 L1,0 L1,1 L0,1 Z")
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn boolean_subtract(_path1: String, _path2: String) -> String {
|
||||
String::from("M0,0 L1,0 L1,1 L0,1 Z")
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn boolean_intersect(_path1: String, _path2: String) -> String {
|
||||
String::from("M0,0 L1,0 L1,1 L0,1 Z")
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn boolean_difference(_path1: String, _path2: String) -> String {
|
||||
String::from("M0,0 L1,0 L1,1 L0,1 Z")
|
||||
}
|
||||
|
||||
@@ -93,7 +93,10 @@ fn render_svg(data: impl GraphicElementRendered, mut render: SvgRender, render_p
|
||||
attributes.push("y", "0");
|
||||
attributes.push("width", footprint.resolution.x.to_string());
|
||||
attributes.push("height", footprint.resolution.y.to_string());
|
||||
attributes.push("transform", format_transform_matrix(footprint.transform.inverse()));
|
||||
let matrix = format_transform_matrix(footprint.transform.inverse());
|
||||
if !matrix.is_empty() {
|
||||
attributes.push("transform", matrix);
|
||||
}
|
||||
attributes.push("fill", "white");
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user