Skip to content

Commit f557130

Browse files
committed
✨ Upgrade core:svg_node from old versions
1 parent 517ae0b commit f557130

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

app/src/core/stage/ProjectUpgrader.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,29 @@ export namespace ProjectUpgrader {
528528
break;
529529
}
530530
case "core:svg_node": {
531-
// svg节点,先不管
531+
// svg节点,和图片一样,要处理附件
532+
const code = entity.content;
533+
const attachmentId = crypto.randomUUID();
534+
const blob = new Blob([code], { type: "image/svg+xml" });
535+
attachments.set(attachmentId, blob);
536+
data = {
537+
_: "SvgNode",
538+
uuid: entity.uuid,
539+
attachmentId,
540+
details: toDetails(entity.details),
541+
collisionBox: {
542+
_: "CollisionBox",
543+
shapes: [
544+
{
545+
_: "Rectangle",
546+
location: toVector(entity.location),
547+
size: toVector(entity.size),
548+
},
549+
],
550+
},
551+
scale: entity.scale || 1,
552+
color: toColor(entity.color),
553+
};
532554
break;
533555
}
534556
default: {

0 commit comments

Comments
 (0)