Use overlays to draw artboard names (#1981)

* Artboard label overlay

* Finish artboard overlays

* cargo fmt

* Update font styling

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
James Lindsay
2024-09-20 23:04:31 +01:00
committed by GitHub
parent 32da545a49
commit 0d33a1ae3f
8 changed files with 71 additions and 55 deletions

View File

@@ -599,22 +599,6 @@ impl GraphicElementRendered for Artboard {
attributes.push("height", self.dimensions.y.abs().to_string());
});
}
if !render_params.hide_artboards && !render_params.for_export {
// Label
render.parent_tag(
"text",
|attributes| {
attributes.push("fill", "white");
attributes.push("x", (self.location.x.min(self.location.x + self.dimensions.x)).to_string());
attributes.push("y", (self.location.y.min(self.location.y + self.dimensions.y) - 4).to_string());
attributes.push("font-size", "14px");
},
|render| {
// TODO: Use the artboard's layer name
render.svg.push(self.label.to_string().into());
},
);
}
// Contents group (includes the artwork but not the background)
render.parent_tag(