mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 13:58:12 +08:00
Export current document as SVG when pressing Ctrl+Shift+S (#160)
* Export current document when pressing Ctrl+Shift+S * Use a blob for download * Add Ctrl + E shortcut, match on lower case * Don't mount element in DOM * Polish some keybindings * Add initialization for MappingEntries * Implement svg coloring * Add newline after svg tag * Add spaces to svg style format * Fix more svg formatting * Add space before /> * Remove duplicate whitespace
This commit is contained in:
@@ -24,10 +24,13 @@ impl LayerData for PolyLine {
|
||||
return;
|
||||
}
|
||||
let _ = write!(svg, r#"<polyline points=""#);
|
||||
for p in &self.points {
|
||||
let _ = write!(svg, " {:.3} {:.3}", p.x, p.y);
|
||||
let mut points = self.points.iter();
|
||||
let first = points.next().unwrap();
|
||||
let _ = write!(svg, "{:.3} {:.3}", first.x, first.y);
|
||||
for point in points {
|
||||
let _ = write!(svg, " {:.3} {:.3}", point.x, point.y);
|
||||
}
|
||||
let _ = write!(svg, r#"" {}/>"#, self.style.render());
|
||||
let _ = write!(svg, r#""{} />"#, self.style.render());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,5 +44,5 @@ fn polyline_should_render() {
|
||||
|
||||
let mut svg = String::new();
|
||||
polyline.render(&mut svg);
|
||||
assert_eq!(r#"<polyline points=" 3.000 4.124 1.000 5.540" style="stroke: #00FF00FF;stroke-width:0.4;"/>"#, svg);
|
||||
assert_eq!(r##"<polyline points="3.000 4.124 1.000 5.540" stroke="#00FF00" stroke-width="0.4" />"##, svg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user