mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-10 04:20:55 +08:00
Refactor bezier-rs' to_svg functionality (#758)
* Change Bezier to_svg to include handles and endpoints * Move params into brackets of format macro, remove unused comment * Use write macro instead of format * Fix path for watched directory * Refactor functions to remove ToSVGOptions
This commit is contained in:
@@ -5,6 +5,12 @@ pub const SVG_CLOSE_TAG: &str = "</svg>";
|
||||
// Stylistic constants
|
||||
pub const BLACK: &str = "black";
|
||||
|
||||
// Default attributes
|
||||
pub const CURVE_ATTRIBUTES: &str = "stroke=\"black\" stroke-width=\"2\" fill=\"none\"";
|
||||
pub const HANDLE_LINE_ATTRIBUTES: &str = "stroke=\"gray\" stroke-width=\"1\" fill=\"none\"";
|
||||
pub const ANCHOR_ATTRIBUTES: &str = "r=\"4\" stroke=\"black\" stroke-width=\"2\" fill=\"white\"";
|
||||
pub const HANDLE_ATTRIBUTES: &str = "r=\"3\" stroke=\"gray\" stroke-width=\"1.5\" fill=\"white\"";
|
||||
|
||||
/// Helper function to create an SVG text entitty.
|
||||
pub fn draw_text(text: String, x_pos: f64, y_pos: f64, fill: &str) -> String {
|
||||
format!(r#"<text x="{x_pos}" y="{y_pos}" fill="{fill}">{text}</text>"#)
|
||||
|
||||
Reference in New Issue
Block a user