@mml-io/mml-web-client 0.19.3 → 0.19.4
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/build/index.js +46 -25
- package/build/index.js.map +2 -2
- package/package.json +5 -5
package/build/index.js
CHANGED
|
@@ -985,6 +985,8 @@
|
|
|
985
985
|
case "changeHiddenFrom":
|
|
986
986
|
this.handleChangeHiddenFrom(message);
|
|
987
987
|
break;
|
|
988
|
+
case "changeVisibleTo":
|
|
989
|
+
break;
|
|
988
990
|
case "childrenRemoved":
|
|
989
991
|
this.handleChildrenRemoved(message);
|
|
990
992
|
break;
|
|
@@ -2315,13 +2317,20 @@
|
|
|
2315
2317
|
}
|
|
2316
2318
|
return lerpHSL(previousValue, elementValue, ratio);
|
|
2317
2319
|
}
|
|
2318
|
-
getFloatValueForTime(windowTime, elementValueSetTime, elementValue, previousValue) {
|
|
2319
|
-
|
|
2320
|
+
getFloatValueForTime(windowTime, elementValueSetTime, elementValue, previousValue, isDegrees) {
|
|
2321
|
+
let from = previousValue;
|
|
2320
2322
|
const to = elementValue;
|
|
2321
2323
|
const ratio = this.getLerpRatio(windowTime, elementValueSetTime);
|
|
2322
2324
|
if (ratio >= 1) {
|
|
2323
2325
|
return to;
|
|
2324
2326
|
}
|
|
2327
|
+
if (isDegrees) {
|
|
2328
|
+
if (to - from > 180) {
|
|
2329
|
+
from += 360;
|
|
2330
|
+
} else if (from - to > 180) {
|
|
2331
|
+
from -= 360;
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2325
2334
|
return from + (to - from) * ratio;
|
|
2326
2335
|
}
|
|
2327
2336
|
getLerpRatio(windowTime, elementValueSetTime) {
|
|
@@ -2379,6 +2388,9 @@
|
|
|
2379
2388
|
}
|
|
2380
2389
|
}
|
|
2381
2390
|
function isColorAttribute(attributeState) {
|
|
2391
|
+
return attributeState.type === 2;
|
|
2392
|
+
}
|
|
2393
|
+
function isDegreesAttribute(attributeState) {
|
|
2382
2394
|
return attributeState.type === 1;
|
|
2383
2395
|
}
|
|
2384
2396
|
function isNumberAttribute(attributeState) {
|
|
@@ -2537,7 +2549,7 @@
|
|
|
2537
2549
|
let stale = null;
|
|
2538
2550
|
const state = this.stateByAttribute[key];
|
|
2539
2551
|
for (const animation of state.animationsInOrder) {
|
|
2540
|
-
const [newValue, active] = state.attributeState.type ===
|
|
2552
|
+
const [newValue, active] = state.attributeState.type === 2 ? animation.getColorValueForTime(documentTime) : animation.getFloatValueForTime(documentTime);
|
|
2541
2553
|
if (active === 0) {
|
|
2542
2554
|
updateIfChangedValue(state, newValue);
|
|
2543
2555
|
stale = null;
|
|
@@ -2573,6 +2585,17 @@
|
|
|
2573
2585
|
config.previousValue
|
|
2574
2586
|
)
|
|
2575
2587
|
);
|
|
2588
|
+
} else if (isDegreesAttribute(config)) {
|
|
2589
|
+
updateIfChangedValue(
|
|
2590
|
+
state,
|
|
2591
|
+
lerp2.getFloatValueForTime(
|
|
2592
|
+
this.element.getWindowTime(),
|
|
2593
|
+
config.elementValueSetTime,
|
|
2594
|
+
config.elementValue,
|
|
2595
|
+
config.previousValue,
|
|
2596
|
+
true
|
|
2597
|
+
)
|
|
2598
|
+
);
|
|
2576
2599
|
} else if (isNumberAttribute(config)) {
|
|
2577
2600
|
updateIfChangedValue(
|
|
2578
2601
|
state,
|
|
@@ -2580,7 +2603,8 @@
|
|
|
2580
2603
|
this.element.getWindowTime(),
|
|
2581
2604
|
config.elementValueSetTime,
|
|
2582
2605
|
config.elementValue,
|
|
2583
|
-
config.previousValue
|
|
2606
|
+
config.previousValue,
|
|
2607
|
+
false
|
|
2584
2608
|
)
|
|
2585
2609
|
);
|
|
2586
2610
|
}
|
|
@@ -3592,7 +3616,7 @@
|
|
|
3592
3616
|
}
|
|
3593
3617
|
],
|
|
3594
3618
|
rx: [
|
|
3595
|
-
|
|
3619
|
+
1,
|
|
3596
3620
|
0,
|
|
3597
3621
|
(newValue) => {
|
|
3598
3622
|
var _a2;
|
|
@@ -3602,7 +3626,7 @@
|
|
|
3602
3626
|
}
|
|
3603
3627
|
],
|
|
3604
3628
|
ry: [
|
|
3605
|
-
|
|
3629
|
+
1,
|
|
3606
3630
|
0,
|
|
3607
3631
|
(newValue) => {
|
|
3608
3632
|
var _a2;
|
|
@@ -3612,7 +3636,7 @@
|
|
|
3612
3636
|
}
|
|
3613
3637
|
],
|
|
3614
3638
|
rz: [
|
|
3615
|
-
|
|
3639
|
+
1,
|
|
3616
3640
|
0,
|
|
3617
3641
|
(newValue) => {
|
|
3618
3642
|
var _a2;
|
|
@@ -4474,7 +4498,7 @@
|
|
|
4474
4498
|
};
|
|
4475
4499
|
this.cubeAnimatedAttributeHelper = new AnimatedAttributeHelper(this, {
|
|
4476
4500
|
color: [
|
|
4477
|
-
|
|
4501
|
+
2,
|
|
4478
4502
|
defaultCubeColor,
|
|
4479
4503
|
(newValue) => {
|
|
4480
4504
|
var _a2;
|
|
@@ -4653,7 +4677,7 @@
|
|
|
4653
4677
|
};
|
|
4654
4678
|
this.cylinderAnimatedAttributeHelper = new AnimatedAttributeHelper(this, {
|
|
4655
4679
|
color: [
|
|
4656
|
-
|
|
4680
|
+
2,
|
|
4657
4681
|
defaultCylinderColor,
|
|
4658
4682
|
(newValue) => {
|
|
4659
4683
|
var _a2;
|
|
@@ -6024,7 +6048,7 @@
|
|
|
6024
6048
|
this.collideableHelper = new CollideableHelper(this);
|
|
6025
6049
|
this.labelAnimatedAttributeHelper = new AnimatedAttributeHelper(this, {
|
|
6026
6050
|
color: [
|
|
6027
|
-
|
|
6051
|
+
2,
|
|
6028
6052
|
defaultLabelColor,
|
|
6029
6053
|
(newValue) => {
|
|
6030
6054
|
var _a2;
|
|
@@ -6033,7 +6057,7 @@
|
|
|
6033
6057
|
}
|
|
6034
6058
|
],
|
|
6035
6059
|
"font-color": [
|
|
6036
|
-
|
|
6060
|
+
2,
|
|
6037
6061
|
defaultFontColor,
|
|
6038
6062
|
(newValue) => {
|
|
6039
6063
|
var _a2;
|
|
@@ -6236,7 +6260,7 @@
|
|
|
6236
6260
|
super();
|
|
6237
6261
|
this.lightAnimatedAttributeHelper = new AnimatedAttributeHelper(this, {
|
|
6238
6262
|
color: [
|
|
6239
|
-
|
|
6263
|
+
2,
|
|
6240
6264
|
defaultLightColor,
|
|
6241
6265
|
(newValue) => {
|
|
6242
6266
|
var _a2;
|
|
@@ -6509,7 +6533,7 @@
|
|
|
6509
6533
|
};
|
|
6510
6534
|
this.planeAnimatedAttributeHelper = new AnimatedAttributeHelper(this, {
|
|
6511
6535
|
color: [
|
|
6512
|
-
|
|
6536
|
+
2,
|
|
6513
6537
|
defaultPlaneColor,
|
|
6514
6538
|
(newValue) => {
|
|
6515
6539
|
var _a2;
|
|
@@ -7091,7 +7115,7 @@
|
|
|
7091
7115
|
};
|
|
7092
7116
|
this.sphereAnimatedAttributeHelper = new AnimatedAttributeHelper(this, {
|
|
7093
7117
|
color: [
|
|
7094
|
-
|
|
7118
|
+
2,
|
|
7095
7119
|
defaultSphereColor,
|
|
7096
7120
|
(newValue) => {
|
|
7097
7121
|
var _a2;
|
|
@@ -97231,10 +97255,13 @@ void main() {
|
|
|
97231
97255
|
this.mesh.castShadow = castShadows;
|
|
97232
97256
|
}
|
|
97233
97257
|
setOpacity(opacity) {
|
|
97234
|
-
const
|
|
97235
|
-
this.material.transparent
|
|
97236
|
-
this.material.
|
|
97258
|
+
const shouldBeTransparent = opacity !== 1 || this.loadedImageHasTransparency;
|
|
97259
|
+
const needsUpdate = this.material.transparent !== shouldBeTransparent;
|
|
97260
|
+
this.material.transparent = shouldBeTransparent;
|
|
97237
97261
|
this.material.opacity = opacity;
|
|
97262
|
+
if (needsUpdate) {
|
|
97263
|
+
this.material.needsUpdate = true;
|
|
97264
|
+
}
|
|
97238
97265
|
}
|
|
97239
97266
|
setEmissive() {
|
|
97240
97267
|
this.updateMaterialEmissiveIntensity();
|
|
@@ -97327,15 +97354,9 @@ void main() {
|
|
|
97327
97354
|
if (!this.material) {
|
|
97328
97355
|
return;
|
|
97329
97356
|
}
|
|
97330
|
-
if (this.loadedImageHasTransparency) {
|
|
97331
|
-
this.material.alphaMap = new CanvasTexture(this.loadedImage);
|
|
97332
|
-
this.material.alphaTest = 0.01;
|
|
97333
|
-
} else {
|
|
97334
|
-
this.material.alphaMap = null;
|
|
97335
|
-
this.material.alphaTest = 0;
|
|
97336
|
-
}
|
|
97337
|
-
this.material.transparent = this.image.props.opacity !== 1 || this.loadedImageHasTransparency;
|
|
97338
97357
|
this.material.map = new CanvasTexture(this.loadedImage);
|
|
97358
|
+
this.material.transparent = this.image.props.opacity !== 1 || this.loadedImageHasTransparency;
|
|
97359
|
+
this.material.alphaTest = 0.01;
|
|
97339
97360
|
this.material.needsUpdate = true;
|
|
97340
97361
|
this.updateMaterialEmissiveIntensity();
|
|
97341
97362
|
this.updateWidthAndHeight();
|