untitled-pixi-live2d-engine 1.2.1 → 1.2.2
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/dist/cubism-legacy.es.js +27 -12
- package/dist/cubism-legacy.js +27 -12
- package/dist/cubism-legacy.min.js +1 -1
- package/dist/cubism.es.js +162 -17
- package/dist/cubism.js +162 -17
- package/dist/cubism.min.js +1 -1
- package/dist/index.es.js +162 -17
- package/dist/index.js +162 -17
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +12 -15
package/dist/index.es.js
CHANGED
|
@@ -106,7 +106,7 @@ const config = {
|
|
|
106
106
|
preserveExpressionOnMotion: true,
|
|
107
107
|
cubism: CubismFrameworkConfig
|
|
108
108
|
};
|
|
109
|
-
const VERSION = "1.2.
|
|
109
|
+
const VERSION = "1.2.2";
|
|
110
110
|
const logger = {
|
|
111
111
|
log(tag, ...messages) {
|
|
112
112
|
if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
|
|
@@ -1477,6 +1477,118 @@ class MotionManager extends EventEmitter {
|
|
|
1477
1477
|
return definition;
|
|
1478
1478
|
}
|
|
1479
1479
|
}
|
|
1480
|
+
function setScale(matrix, scale) {
|
|
1481
|
+
matrix.a = scale;
|
|
1482
|
+
matrix.b = 0;
|
|
1483
|
+
matrix.c = 0;
|
|
1484
|
+
matrix.d = scale;
|
|
1485
|
+
}
|
|
1486
|
+
function getLayoutEntries(rawLayout) {
|
|
1487
|
+
const entries = [];
|
|
1488
|
+
for (const [key, value] of Object.entries(rawLayout)) {
|
|
1489
|
+
if (typeof value !== "number") {
|
|
1490
|
+
continue;
|
|
1491
|
+
}
|
|
1492
|
+
entries.push([key, value]);
|
|
1493
|
+
}
|
|
1494
|
+
return entries;
|
|
1495
|
+
}
|
|
1496
|
+
function setupLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
1497
|
+
var _a, _b;
|
|
1498
|
+
const layout = __spreadValues({
|
|
1499
|
+
width: LOGICAL_WIDTH,
|
|
1500
|
+
height: LOGICAL_HEIGHT
|
|
1501
|
+
}, rawLayout);
|
|
1502
|
+
const layoutWidth = (_a = layout.width) != null ? _a : LOGICAL_WIDTH;
|
|
1503
|
+
const layoutHeight = (_b = layout.height) != null ? _b : LOGICAL_HEIGHT;
|
|
1504
|
+
matrix.identity();
|
|
1505
|
+
matrix.scale(layoutWidth / LOGICAL_WIDTH, layoutHeight / LOGICAL_HEIGHT);
|
|
1506
|
+
const width = originalWidth * matrix.a;
|
|
1507
|
+
const height = originalHeight * matrix.d;
|
|
1508
|
+
const offsetX = layout.x !== void 0 && layout.x - layoutWidth / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layoutWidth / 2 || layout.right !== void 0 && layout.right + layoutWidth / 2 || 0;
|
|
1509
|
+
const offsetY = layout.y !== void 0 && layout.y - layoutHeight / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layoutHeight / 2 || layout.bottom !== void 0 && layout.bottom + layoutHeight / 2 || 0;
|
|
1510
|
+
matrix.translate(width * offsetX, -height * offsetY);
|
|
1511
|
+
return {
|
|
1512
|
+
width,
|
|
1513
|
+
height
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
function getCubismLayoutWidth(state, aspect) {
|
|
1517
|
+
return LOGICAL_HEIGHT * aspect * state.scale;
|
|
1518
|
+
}
|
|
1519
|
+
function getCubismLayoutHeight(state) {
|
|
1520
|
+
return LOGICAL_HEIGHT * state.scale;
|
|
1521
|
+
}
|
|
1522
|
+
function setCubismWidth(state, aspect, width) {
|
|
1523
|
+
state.scale = width / (LOGICAL_HEIGHT * aspect);
|
|
1524
|
+
}
|
|
1525
|
+
function setCubismHeight(state, height) {
|
|
1526
|
+
state.scale = height / LOGICAL_HEIGHT;
|
|
1527
|
+
}
|
|
1528
|
+
function setCubismX(state, x) {
|
|
1529
|
+
state.x = x;
|
|
1530
|
+
}
|
|
1531
|
+
function setCubismY(state, y) {
|
|
1532
|
+
state.y = y;
|
|
1533
|
+
}
|
|
1534
|
+
function centerCubismX(state, aspect, x) {
|
|
1535
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect) / 2);
|
|
1536
|
+
}
|
|
1537
|
+
function centerCubismY(state, y) {
|
|
1538
|
+
setCubismY(state, y - getCubismLayoutHeight(state) / 2);
|
|
1539
|
+
}
|
|
1540
|
+
function rightCubism(state, aspect, x) {
|
|
1541
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect));
|
|
1542
|
+
}
|
|
1543
|
+
function bottomCubism(state, y) {
|
|
1544
|
+
setCubismY(state, y - getCubismLayoutHeight(state));
|
|
1545
|
+
}
|
|
1546
|
+
function setupCubismLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
1547
|
+
if (originalWidth <= 0 || originalHeight <= 0) {
|
|
1548
|
+
matrix.identity();
|
|
1549
|
+
return { width: 0, height: 0 };
|
|
1550
|
+
}
|
|
1551
|
+
const entries = getLayoutEntries(rawLayout);
|
|
1552
|
+
const aspect = originalWidth / originalHeight;
|
|
1553
|
+
const state = { scale: 1, x: 0, y: 0 };
|
|
1554
|
+
for (const [key, value] of entries) {
|
|
1555
|
+
if (key === "width") {
|
|
1556
|
+
setCubismWidth(state, aspect, value);
|
|
1557
|
+
} else if (key === "height") {
|
|
1558
|
+
setCubismHeight(state, value);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
for (const [key, value] of entries) {
|
|
1562
|
+
if (key === "x") {
|
|
1563
|
+
setCubismX(state, value);
|
|
1564
|
+
} else if (key === "y") {
|
|
1565
|
+
setCubismY(state, value);
|
|
1566
|
+
} else if (key === "centerX") {
|
|
1567
|
+
centerCubismX(state, aspect, value);
|
|
1568
|
+
} else if (key === "centerY") {
|
|
1569
|
+
centerCubismY(state, value);
|
|
1570
|
+
} else if (key === "top") {
|
|
1571
|
+
setCubismY(state, value);
|
|
1572
|
+
} else if (key === "bottom") {
|
|
1573
|
+
bottomCubism(state, value);
|
|
1574
|
+
} else if (key === "left") {
|
|
1575
|
+
setCubismX(state, value);
|
|
1576
|
+
} else if (key === "right") {
|
|
1577
|
+
rightCubism(state, aspect, value);
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
const pixelsPerLogicalUnit = originalHeight / LOGICAL_HEIGHT;
|
|
1581
|
+
const defaultLogicalHalfWidth = LOGICAL_HEIGHT * aspect / 2;
|
|
1582
|
+
const defaultLogicalHalfHeight = LOGICAL_HEIGHT / 2;
|
|
1583
|
+
matrix.identity();
|
|
1584
|
+
setScale(matrix, state.scale);
|
|
1585
|
+
matrix.tx = pixelsPerLogicalUnit * (state.x + defaultLogicalHalfWidth) - originalWidth * state.scale / 2;
|
|
1586
|
+
matrix.ty = pixelsPerLogicalUnit * (defaultLogicalHalfHeight - state.y) - originalHeight * state.scale / 2;
|
|
1587
|
+
return {
|
|
1588
|
+
width: originalWidth * state.scale,
|
|
1589
|
+
height: originalHeight * state.scale
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1480
1592
|
function normalizeHitAreaDefs(raw, resolveIndex) {
|
|
1481
1593
|
if (!Array.isArray(raw)) {
|
|
1482
1594
|
return [];
|
|
@@ -1566,19 +1678,14 @@ class InternalModel extends EventEmitter {
|
|
|
1566
1678
|
const size = this.getSize();
|
|
1567
1679
|
self.originalWidth = size[0];
|
|
1568
1680
|
self.originalHeight = size[1];
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
},
|
|
1681
|
+
const bounds = setupLayoutMatrix(
|
|
1682
|
+
this.localTransform,
|
|
1683
|
+
this.originalWidth,
|
|
1684
|
+
this.originalHeight,
|
|
1574
1685
|
this.getLayout()
|
|
1575
1686
|
);
|
|
1576
|
-
|
|
1577
|
-
self.
|
|
1578
|
-
self.height = this.originalHeight * this.localTransform.d;
|
|
1579
|
-
const offsetX = layout.x !== void 0 && layout.x - layout.width / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layout.width / 2 || layout.right !== void 0 && layout.right + layout.width / 2 || 0;
|
|
1580
|
-
const offsetY = layout.y !== void 0 && layout.y - layout.height / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layout.height / 2 || layout.bottom !== void 0 && layout.bottom + layout.height / 2 || 0;
|
|
1581
|
-
this.localTransform.translate(this.width * offsetX, -this.height * offsetY);
|
|
1687
|
+
self.width = bounds.width;
|
|
1688
|
+
self.height = bounds.height;
|
|
1582
1689
|
}
|
|
1583
1690
|
/**
|
|
1584
1691
|
* Sets up the hit areas by their definitions in settings.
|
|
@@ -9585,6 +9692,7 @@ class CubismMotionManager extends MotionManager {
|
|
|
9585
9692
|
shouldCheckMotionConsistency
|
|
9586
9693
|
);
|
|
9587
9694
|
const json = new CubismMotionJson(data, data.byteLength);
|
|
9695
|
+
motion.setLoop(json.isMotionLoop());
|
|
9588
9696
|
const defaultFadingDuration = (group === this.groups.idle ? config.idleMotionFadingDuration : config.motionFadingDuration) / 1e3;
|
|
9589
9697
|
if (json.getMotionFadeInTime() === void 0) {
|
|
9590
9698
|
motion.setFadeInTime(
|
|
@@ -12154,6 +12262,30 @@ const HIGH_PRECISION_MASK_MAX_MASKS_PER_DRAWABLE_THRESHOLD = 3;
|
|
|
12154
12262
|
const HIGH_PRECISION_MASK_MASKED_VERTEX_THRESHOLD = 4096;
|
|
12155
12263
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_THRESHOLD = 0.5;
|
|
12156
12264
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_DRAWABLE_THRESHOLD = 24;
|
|
12265
|
+
const layoutKeyMap = {
|
|
12266
|
+
CenterX: "centerX",
|
|
12267
|
+
centerX: "centerX",
|
|
12268
|
+
center_x: "centerX",
|
|
12269
|
+
CenterY: "centerY",
|
|
12270
|
+
centerY: "centerY",
|
|
12271
|
+
center_y: "centerY",
|
|
12272
|
+
X: "x",
|
|
12273
|
+
x: "x",
|
|
12274
|
+
Y: "y",
|
|
12275
|
+
y: "y",
|
|
12276
|
+
Width: "width",
|
|
12277
|
+
width: "width",
|
|
12278
|
+
Height: "height",
|
|
12279
|
+
height: "height",
|
|
12280
|
+
Top: "top",
|
|
12281
|
+
top: "top",
|
|
12282
|
+
Bottom: "bottom",
|
|
12283
|
+
bottom: "bottom",
|
|
12284
|
+
Left: "left",
|
|
12285
|
+
left: "left",
|
|
12286
|
+
Right: "right",
|
|
12287
|
+
right: "right"
|
|
12288
|
+
};
|
|
12157
12289
|
function getRequiredMaskRenderTextureCount(model) {
|
|
12158
12290
|
var _a;
|
|
12159
12291
|
if (!model.isUsingMasking()) {
|
|
@@ -12336,16 +12468,29 @@ class CubismInternalModel extends InternalModel {
|
|
|
12336
12468
|
const settingsLayout = this.settings.layout;
|
|
12337
12469
|
if (settingsLayout) {
|
|
12338
12470
|
for (const [key, value] of Object.entries(settingsLayout)) {
|
|
12339
|
-
const commonKey = key
|
|
12340
|
-
|
|
12471
|
+
const commonKey = layoutKeyMap[key];
|
|
12472
|
+
if (commonKey && typeof value === "number") {
|
|
12473
|
+
layout[commonKey] = value;
|
|
12474
|
+
}
|
|
12341
12475
|
}
|
|
12342
12476
|
}
|
|
12343
12477
|
return layout;
|
|
12344
12478
|
}
|
|
12345
12479
|
setupLayout() {
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12480
|
+
const self = this;
|
|
12481
|
+
const size = this.getSize();
|
|
12482
|
+
self.originalWidth = size[0];
|
|
12483
|
+
self.originalHeight = size[1];
|
|
12484
|
+
self.pixelsPerUnit = this.coreModel.getModel().canvasinfo.PixelsPerUnit;
|
|
12485
|
+
const bounds = setupCubismLayoutMatrix(
|
|
12486
|
+
this.localTransform,
|
|
12487
|
+
this.originalWidth,
|
|
12488
|
+
this.originalHeight,
|
|
12489
|
+
this.getLayout()
|
|
12490
|
+
);
|
|
12491
|
+
self.width = bounds.width;
|
|
12492
|
+
self.height = bounds.height;
|
|
12493
|
+
this.modelTransform.identity().scale(this.pixelsPerUnit, this.pixelsPerUnit).translate(this.originalWidth / 2, this.originalHeight / 2);
|
|
12349
12494
|
}
|
|
12350
12495
|
updateWebGLContext(gl, glContextID) {
|
|
12351
12496
|
this.renderer.firstDraw = true;
|
package/dist/index.js
CHANGED
|
@@ -108,7 +108,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
108
108
|
preserveExpressionOnMotion: true,
|
|
109
109
|
cubism: CubismFrameworkConfig
|
|
110
110
|
};
|
|
111
|
-
const VERSION = "1.2.
|
|
111
|
+
const VERSION = "1.2.2";
|
|
112
112
|
const logger = {
|
|
113
113
|
log(tag, ...messages) {
|
|
114
114
|
if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
|
|
@@ -1479,6 +1479,118 @@ var __async = (__this, __arguments, generator) => {
|
|
|
1479
1479
|
return definition;
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
|
+
function setScale(matrix, scale) {
|
|
1483
|
+
matrix.a = scale;
|
|
1484
|
+
matrix.b = 0;
|
|
1485
|
+
matrix.c = 0;
|
|
1486
|
+
matrix.d = scale;
|
|
1487
|
+
}
|
|
1488
|
+
function getLayoutEntries(rawLayout) {
|
|
1489
|
+
const entries = [];
|
|
1490
|
+
for (const [key, value] of Object.entries(rawLayout)) {
|
|
1491
|
+
if (typeof value !== "number") {
|
|
1492
|
+
continue;
|
|
1493
|
+
}
|
|
1494
|
+
entries.push([key, value]);
|
|
1495
|
+
}
|
|
1496
|
+
return entries;
|
|
1497
|
+
}
|
|
1498
|
+
function setupLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
1499
|
+
var _a, _b;
|
|
1500
|
+
const layout = __spreadValues({
|
|
1501
|
+
width: LOGICAL_WIDTH,
|
|
1502
|
+
height: LOGICAL_HEIGHT
|
|
1503
|
+
}, rawLayout);
|
|
1504
|
+
const layoutWidth = (_a = layout.width) != null ? _a : LOGICAL_WIDTH;
|
|
1505
|
+
const layoutHeight = (_b = layout.height) != null ? _b : LOGICAL_HEIGHT;
|
|
1506
|
+
matrix.identity();
|
|
1507
|
+
matrix.scale(layoutWidth / LOGICAL_WIDTH, layoutHeight / LOGICAL_HEIGHT);
|
|
1508
|
+
const width = originalWidth * matrix.a;
|
|
1509
|
+
const height = originalHeight * matrix.d;
|
|
1510
|
+
const offsetX = layout.x !== void 0 && layout.x - layoutWidth / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layoutWidth / 2 || layout.right !== void 0 && layout.right + layoutWidth / 2 || 0;
|
|
1511
|
+
const offsetY = layout.y !== void 0 && layout.y - layoutHeight / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layoutHeight / 2 || layout.bottom !== void 0 && layout.bottom + layoutHeight / 2 || 0;
|
|
1512
|
+
matrix.translate(width * offsetX, -height * offsetY);
|
|
1513
|
+
return {
|
|
1514
|
+
width,
|
|
1515
|
+
height
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
function getCubismLayoutWidth(state, aspect) {
|
|
1519
|
+
return LOGICAL_HEIGHT * aspect * state.scale;
|
|
1520
|
+
}
|
|
1521
|
+
function getCubismLayoutHeight(state) {
|
|
1522
|
+
return LOGICAL_HEIGHT * state.scale;
|
|
1523
|
+
}
|
|
1524
|
+
function setCubismWidth(state, aspect, width) {
|
|
1525
|
+
state.scale = width / (LOGICAL_HEIGHT * aspect);
|
|
1526
|
+
}
|
|
1527
|
+
function setCubismHeight(state, height) {
|
|
1528
|
+
state.scale = height / LOGICAL_HEIGHT;
|
|
1529
|
+
}
|
|
1530
|
+
function setCubismX(state, x) {
|
|
1531
|
+
state.x = x;
|
|
1532
|
+
}
|
|
1533
|
+
function setCubismY(state, y) {
|
|
1534
|
+
state.y = y;
|
|
1535
|
+
}
|
|
1536
|
+
function centerCubismX(state, aspect, x) {
|
|
1537
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect) / 2);
|
|
1538
|
+
}
|
|
1539
|
+
function centerCubismY(state, y) {
|
|
1540
|
+
setCubismY(state, y - getCubismLayoutHeight(state) / 2);
|
|
1541
|
+
}
|
|
1542
|
+
function rightCubism(state, aspect, x) {
|
|
1543
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect));
|
|
1544
|
+
}
|
|
1545
|
+
function bottomCubism(state, y) {
|
|
1546
|
+
setCubismY(state, y - getCubismLayoutHeight(state));
|
|
1547
|
+
}
|
|
1548
|
+
function setupCubismLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
1549
|
+
if (originalWidth <= 0 || originalHeight <= 0) {
|
|
1550
|
+
matrix.identity();
|
|
1551
|
+
return { width: 0, height: 0 };
|
|
1552
|
+
}
|
|
1553
|
+
const entries = getLayoutEntries(rawLayout);
|
|
1554
|
+
const aspect = originalWidth / originalHeight;
|
|
1555
|
+
const state = { scale: 1, x: 0, y: 0 };
|
|
1556
|
+
for (const [key, value] of entries) {
|
|
1557
|
+
if (key === "width") {
|
|
1558
|
+
setCubismWidth(state, aspect, value);
|
|
1559
|
+
} else if (key === "height") {
|
|
1560
|
+
setCubismHeight(state, value);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
for (const [key, value] of entries) {
|
|
1564
|
+
if (key === "x") {
|
|
1565
|
+
setCubismX(state, value);
|
|
1566
|
+
} else if (key === "y") {
|
|
1567
|
+
setCubismY(state, value);
|
|
1568
|
+
} else if (key === "centerX") {
|
|
1569
|
+
centerCubismX(state, aspect, value);
|
|
1570
|
+
} else if (key === "centerY") {
|
|
1571
|
+
centerCubismY(state, value);
|
|
1572
|
+
} else if (key === "top") {
|
|
1573
|
+
setCubismY(state, value);
|
|
1574
|
+
} else if (key === "bottom") {
|
|
1575
|
+
bottomCubism(state, value);
|
|
1576
|
+
} else if (key === "left") {
|
|
1577
|
+
setCubismX(state, value);
|
|
1578
|
+
} else if (key === "right") {
|
|
1579
|
+
rightCubism(state, aspect, value);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
const pixelsPerLogicalUnit = originalHeight / LOGICAL_HEIGHT;
|
|
1583
|
+
const defaultLogicalHalfWidth = LOGICAL_HEIGHT * aspect / 2;
|
|
1584
|
+
const defaultLogicalHalfHeight = LOGICAL_HEIGHT / 2;
|
|
1585
|
+
matrix.identity();
|
|
1586
|
+
setScale(matrix, state.scale);
|
|
1587
|
+
matrix.tx = pixelsPerLogicalUnit * (state.x + defaultLogicalHalfWidth) - originalWidth * state.scale / 2;
|
|
1588
|
+
matrix.ty = pixelsPerLogicalUnit * (defaultLogicalHalfHeight - state.y) - originalHeight * state.scale / 2;
|
|
1589
|
+
return {
|
|
1590
|
+
width: originalWidth * state.scale,
|
|
1591
|
+
height: originalHeight * state.scale
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1482
1594
|
function normalizeHitAreaDefs(raw, resolveIndex) {
|
|
1483
1595
|
if (!Array.isArray(raw)) {
|
|
1484
1596
|
return [];
|
|
@@ -1568,19 +1680,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
1568
1680
|
const size = this.getSize();
|
|
1569
1681
|
self2.originalWidth = size[0];
|
|
1570
1682
|
self2.originalHeight = size[1];
|
|
1571
|
-
const
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
},
|
|
1683
|
+
const bounds = setupLayoutMatrix(
|
|
1684
|
+
this.localTransform,
|
|
1685
|
+
this.originalWidth,
|
|
1686
|
+
this.originalHeight,
|
|
1576
1687
|
this.getLayout()
|
|
1577
1688
|
);
|
|
1578
|
-
|
|
1579
|
-
self2.
|
|
1580
|
-
self2.height = this.originalHeight * this.localTransform.d;
|
|
1581
|
-
const offsetX = layout.x !== void 0 && layout.x - layout.width / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layout.width / 2 || layout.right !== void 0 && layout.right + layout.width / 2 || 0;
|
|
1582
|
-
const offsetY = layout.y !== void 0 && layout.y - layout.height / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layout.height / 2 || layout.bottom !== void 0 && layout.bottom + layout.height / 2 || 0;
|
|
1583
|
-
this.localTransform.translate(this.width * offsetX, -this.height * offsetY);
|
|
1689
|
+
self2.width = bounds.width;
|
|
1690
|
+
self2.height = bounds.height;
|
|
1584
1691
|
}
|
|
1585
1692
|
/**
|
|
1586
1693
|
* Sets up the hit areas by their definitions in settings.
|
|
@@ -9587,6 +9694,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
9587
9694
|
shouldCheckMotionConsistency
|
|
9588
9695
|
);
|
|
9589
9696
|
const json = new CubismMotionJson(data, data.byteLength);
|
|
9697
|
+
motion.setLoop(json.isMotionLoop());
|
|
9590
9698
|
const defaultFadingDuration = (group === this.groups.idle ? config.idleMotionFadingDuration : config.motionFadingDuration) / 1e3;
|
|
9591
9699
|
if (json.getMotionFadeInTime() === void 0) {
|
|
9592
9700
|
motion.setFadeInTime(
|
|
@@ -12156,6 +12264,30 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12156
12264
|
const HIGH_PRECISION_MASK_MASKED_VERTEX_THRESHOLD = 4096;
|
|
12157
12265
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_THRESHOLD = 0.5;
|
|
12158
12266
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_DRAWABLE_THRESHOLD = 24;
|
|
12267
|
+
const layoutKeyMap = {
|
|
12268
|
+
CenterX: "centerX",
|
|
12269
|
+
centerX: "centerX",
|
|
12270
|
+
center_x: "centerX",
|
|
12271
|
+
CenterY: "centerY",
|
|
12272
|
+
centerY: "centerY",
|
|
12273
|
+
center_y: "centerY",
|
|
12274
|
+
X: "x",
|
|
12275
|
+
x: "x",
|
|
12276
|
+
Y: "y",
|
|
12277
|
+
y: "y",
|
|
12278
|
+
Width: "width",
|
|
12279
|
+
width: "width",
|
|
12280
|
+
Height: "height",
|
|
12281
|
+
height: "height",
|
|
12282
|
+
Top: "top",
|
|
12283
|
+
top: "top",
|
|
12284
|
+
Bottom: "bottom",
|
|
12285
|
+
bottom: "bottom",
|
|
12286
|
+
Left: "left",
|
|
12287
|
+
left: "left",
|
|
12288
|
+
Right: "right",
|
|
12289
|
+
right: "right"
|
|
12290
|
+
};
|
|
12159
12291
|
function getRequiredMaskRenderTextureCount(model) {
|
|
12160
12292
|
var _a;
|
|
12161
12293
|
if (!model.isUsingMasking()) {
|
|
@@ -12338,16 +12470,29 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12338
12470
|
const settingsLayout = this.settings.layout;
|
|
12339
12471
|
if (settingsLayout) {
|
|
12340
12472
|
for (const [key, value] of Object.entries(settingsLayout)) {
|
|
12341
|
-
const commonKey = key
|
|
12342
|
-
|
|
12473
|
+
const commonKey = layoutKeyMap[key];
|
|
12474
|
+
if (commonKey && typeof value === "number") {
|
|
12475
|
+
layout[commonKey] = value;
|
|
12476
|
+
}
|
|
12343
12477
|
}
|
|
12344
12478
|
}
|
|
12345
12479
|
return layout;
|
|
12346
12480
|
}
|
|
12347
12481
|
setupLayout() {
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12482
|
+
const self2 = this;
|
|
12483
|
+
const size = this.getSize();
|
|
12484
|
+
self2.originalWidth = size[0];
|
|
12485
|
+
self2.originalHeight = size[1];
|
|
12486
|
+
self2.pixelsPerUnit = this.coreModel.getModel().canvasinfo.PixelsPerUnit;
|
|
12487
|
+
const bounds = setupCubismLayoutMatrix(
|
|
12488
|
+
this.localTransform,
|
|
12489
|
+
this.originalWidth,
|
|
12490
|
+
this.originalHeight,
|
|
12491
|
+
this.getLayout()
|
|
12492
|
+
);
|
|
12493
|
+
self2.width = bounds.width;
|
|
12494
|
+
self2.height = bounds.height;
|
|
12495
|
+
this.modelTransform.identity().scale(this.pixelsPerUnit, this.pixelsPerUnit).translate(this.originalWidth / 2, this.originalHeight / 2);
|
|
12351
12496
|
}
|
|
12352
12497
|
updateWebGLContext(gl, glContextID) {
|
|
12353
12498
|
this.renderer.firstDraw = true;
|