@meta2d/core 1.0.77 → 1.0.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/canvas/canvas.js +19 -2
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.js +18 -2
- package/src/core.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.js
CHANGED
|
@@ -1115,6 +1115,8 @@ export class Canvas {
|
|
|
1115
1115
|
!pen.parentId && this.randomCombineId(pen, pens);
|
|
1116
1116
|
}
|
|
1117
1117
|
if (Object.keys(this.randomIdObj).length !== 0) {
|
|
1118
|
+
const keys = Object.keys(this.randomIdObj).join('|');
|
|
1119
|
+
const regex = new RegExp(`(${keys})`, "g");
|
|
1118
1120
|
for (const pen of pens) {
|
|
1119
1121
|
if (pen.type) {
|
|
1120
1122
|
pen.anchors[0].connectTo = this.randomIdObj[pen.anchors[0].connectTo];
|
|
@@ -1127,6 +1129,19 @@ export class Canvas {
|
|
|
1127
1129
|
item.lineId = this.randomIdObj[item.lineId];
|
|
1128
1130
|
});
|
|
1129
1131
|
}
|
|
1132
|
+
//动画、事件和状态
|
|
1133
|
+
if (pen.animations?.length) {
|
|
1134
|
+
const str = JSON.stringify(pen.animations).replace(regex, match => this.randomIdObj[match]);
|
|
1135
|
+
pen.animations = JSON.parse(str);
|
|
1136
|
+
}
|
|
1137
|
+
if (pen.triggers?.length) {
|
|
1138
|
+
const str = JSON.stringify(pen.triggers).replace(regex, match => this.randomIdObj[match]);
|
|
1139
|
+
pen.triggers = JSON.parse(str);
|
|
1140
|
+
}
|
|
1141
|
+
if (pen.events?.length) {
|
|
1142
|
+
const str = JSON.stringify(pen.events).replace(regex, match => this.randomIdObj[match]);
|
|
1143
|
+
pen.events = JSON.parse(str);
|
|
1144
|
+
}
|
|
1130
1145
|
}
|
|
1131
1146
|
}
|
|
1132
1147
|
for (const pen of pens) {
|
|
@@ -1237,12 +1252,14 @@ export class Canvas {
|
|
|
1237
1252
|
}
|
|
1238
1253
|
}
|
|
1239
1254
|
else {
|
|
1240
|
-
if (
|
|
1255
|
+
if (pens.length > 1) {
|
|
1256
|
+
// if (pen.connectedLines && pen.connectedLines.length) {
|
|
1241
1257
|
beforeIds = [pen.id];
|
|
1242
1258
|
}
|
|
1243
1259
|
}
|
|
1244
1260
|
randomId(pen);
|
|
1245
|
-
if (
|
|
1261
|
+
if (pens.length > 1) {
|
|
1262
|
+
// if (beforeIds) {
|
|
1246
1263
|
if (beforeIds.length === 1) {
|
|
1247
1264
|
this.randomIdObj[beforeIds[0]] = pen.id;
|
|
1248
1265
|
}
|