mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-19 20:02:06 +00:00
#920 Export instance name to SVG use element
This commit is contained in:
@@ -2304,12 +2304,12 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
clips.add(clip);
|
||||
prevClips.add(exporter.getClip());
|
||||
Matrix mat = Matrix.getTranslateInstance(rect.xMin, rect.yMin).preConcatenate(new Matrix(layer.matrix));
|
||||
exporter.addUse(mat, boundRect, assetName);
|
||||
exporter.addUse(mat, boundRect, assetName, layer.instanceName);
|
||||
exporter.setClip(clip.shape);
|
||||
exporter.endGroup();
|
||||
} else {
|
||||
Matrix mat = Matrix.getTranslateInstance(rect.xMin, rect.yMin).preConcatenate(new Matrix(layer.matrix));
|
||||
exporter.addUse(mat, boundRect, assetName);
|
||||
exporter.addUse(mat, boundRect, assetName, layer.instanceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,13 +207,16 @@ public class SVGExporter {
|
||||
attr.setValue("background: " + new RGBA(backGroundColor).toHexARGB());
|
||||
}
|
||||
|
||||
public Element addUse(Matrix transform, RECT boundRect, String href) {
|
||||
public Element addUse(Matrix transform, RECT boundRect, String href, String instanceName) {
|
||||
Element image = _svg.createElement("use");
|
||||
if (transform != null) {
|
||||
image.setAttribute("transform", transform.getTransformationString(SWF.unitDivisor, 1));
|
||||
image.setAttribute("width", Double.toString(boundRect.getWidth() / (double) SWF.unitDivisor));
|
||||
image.setAttribute("height", Double.toString(boundRect.getHeight() / (double) SWF.unitDivisor));
|
||||
}
|
||||
if (instanceName != null) {
|
||||
image.setAttribute("id", instanceName);
|
||||
}
|
||||
image.setAttribute("xlink:href", "#" + href);
|
||||
if (clip != null) {
|
||||
image.setAttribute("clip-path", "url(#" + clip + ")");
|
||||
|
||||
Reference in New Issue
Block a user