@shopware-ag/dive 1.6.2 → 1.6.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/dive.cjs +30 -8
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +18 -1
- package/build/dive.d.ts +18 -1
- package/build/dive.js +31 -9
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/animation/AnimationSystem.ts +8 -4
- package/src/animation/__test__/AnimationSystem.test.ts +9 -2
- package/src/com/Communication.ts +1 -1
- package/src/com/__test__/Communication.test.ts +1 -2
- package/src/controls/OrbitControls.ts +11 -6
- package/src/controls/__test__/OrbitControls.test.ts +40 -14
- package/src/dive.ts +8 -5
- package/src/mediacreator/__test__/MediaCreator.test.ts +19 -1
- package/src/toolbox/select/__test__/SelectTool.test.ts +27 -1
- package/src/toolbox/transform/__test__/TransformTool.test.ts +26 -1
package/build/dive.cjs
CHANGED
|
@@ -718,7 +718,7 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
718
718
|
}
|
|
719
719
|
get mediaGenerator() {
|
|
720
720
|
if (!this._mediaGenerator) {
|
|
721
|
-
const DIVEMediaCreator2 = (init_MediaCreator(), __toCommonJS(MediaCreator_exports)).
|
|
721
|
+
const DIVEMediaCreator2 = (init_MediaCreator(), __toCommonJS(MediaCreator_exports)).DIVEMediaCreator;
|
|
722
722
|
this._mediaGenerator = new DIVEMediaCreator2(this.renderer, this.scene, this.controller);
|
|
723
723
|
}
|
|
724
724
|
return this._mediaGenerator;
|
|
@@ -1577,7 +1577,7 @@ var DIVEOrbitControlsDefaultSettings = {
|
|
|
1577
1577
|
dampingFactor: 0.04
|
|
1578
1578
|
};
|
|
1579
1579
|
var _DIVEOrbitControls = class _DIVEOrbitControls extends import_Addons3.OrbitControls {
|
|
1580
|
-
constructor(camera, renderer, settings = DIVEOrbitControlsDefaultSettings) {
|
|
1580
|
+
constructor(camera, renderer, animationSystem, settings = DIVEOrbitControlsDefaultSettings) {
|
|
1581
1581
|
super(camera, renderer.domElement);
|
|
1582
1582
|
this.last = null;
|
|
1583
1583
|
this.animating = false;
|
|
@@ -1590,6 +1590,7 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends import_Addons3.OrbitCo
|
|
|
1590
1590
|
if (this.locked) return;
|
|
1591
1591
|
this.update();
|
|
1592
1592
|
};
|
|
1593
|
+
this._animationSystem = animationSystem;
|
|
1593
1594
|
this.domElement = renderer.domElement;
|
|
1594
1595
|
this.object = camera;
|
|
1595
1596
|
renderer.AddPreRenderCallback(() => {
|
|
@@ -1633,8 +1634,8 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends import_Addons3.OrbitCo
|
|
|
1633
1634
|
this.animating = duration > 0;
|
|
1634
1635
|
this.locked = lock;
|
|
1635
1636
|
this.enabled = false;
|
|
1636
|
-
const tweenPos =
|
|
1637
|
-
const tweenQuat =
|
|
1637
|
+
const tweenPos = this._animationSystem.Animate(this.object.position).to(toPosition, duration).easing(import_tween.Easing.Quadratic.Out).start();
|
|
1638
|
+
const tweenQuat = this._animationSystem.Animate(this.target).to(toTarget, duration).easing(import_tween.Easing.Quadratic.Out).onUpdate(() => {
|
|
1638
1639
|
this.object.lookAt(this.target);
|
|
1639
1640
|
}).onComplete(() => {
|
|
1640
1641
|
this.animating = false;
|
|
@@ -1651,8 +1652,8 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends import_Addons3.OrbitCo
|
|
|
1651
1652
|
this.animating = duration > 0;
|
|
1652
1653
|
this.enabled = false;
|
|
1653
1654
|
const { pos, target } = this.last;
|
|
1654
|
-
const tweenPos =
|
|
1655
|
-
const tweenQuat =
|
|
1655
|
+
const tweenPos = this._animationSystem.Animate(this.object.position).to(pos, duration).easing(import_tween.Easing.Quadratic.Out).start();
|
|
1656
|
+
const tweenQuat = this._animationSystem.Animate(this.target).to(target, duration).easing(import_tween.Easing.Quadratic.Out).onUpdate(() => {
|
|
1656
1657
|
this.object.lookAt(this.target);
|
|
1657
1658
|
}).onComplete(() => {
|
|
1658
1659
|
this.animating = false;
|
|
@@ -1746,6 +1747,26 @@ var DIVEToolbox = class {
|
|
|
1746
1747
|
};
|
|
1747
1748
|
DIVEToolbox.DefaultTool = "select";
|
|
1748
1749
|
|
|
1750
|
+
// src/animation/AnimationSystem.ts
|
|
1751
|
+
var import_tween2 = require("@tweenjs/tween.js");
|
|
1752
|
+
var DIVEAnimationSystem = class {
|
|
1753
|
+
constructor(renderer) {
|
|
1754
|
+
this._renderer = renderer;
|
|
1755
|
+
this._rendererCallbackId = this._renderer.AddPreRenderCallback(() => {
|
|
1756
|
+
this.Update();
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
Dispose() {
|
|
1760
|
+
this._renderer.RemovePreRenderCallback(this._rendererCallbackId);
|
|
1761
|
+
}
|
|
1762
|
+
Update() {
|
|
1763
|
+
(0, import_tween2.update)();
|
|
1764
|
+
}
|
|
1765
|
+
Animate(object) {
|
|
1766
|
+
return new import_tween2.Tween(object);
|
|
1767
|
+
}
|
|
1768
|
+
};
|
|
1769
|
+
|
|
1749
1770
|
// src/axiscamera/AxisCamera.ts
|
|
1750
1771
|
var import_three15 = require("three");
|
|
1751
1772
|
var import_three_spritetext = __toESM(require("three-spritetext"), 1);
|
|
@@ -2027,10 +2048,10 @@ var DIVE = class _DIVE {
|
|
|
2027
2048
|
this.renderer = new DIVERenderer(this._settings.renderer);
|
|
2028
2049
|
this.scene = new DIVEScene();
|
|
2029
2050
|
this.perspectiveCamera = new DIVEPerspectiveCamera(this._settings.perspectiveCamera);
|
|
2030
|
-
this.
|
|
2051
|
+
this.animationSystem = new DIVEAnimationSystem(this.renderer);
|
|
2052
|
+
this.orbitControls = new DIVEOrbitControls(this.perspectiveCamera, this.renderer, this.animationSystem, this._settings.orbitControls);
|
|
2031
2053
|
this.toolbox = new DIVEToolbox(this.scene, this.orbitControls);
|
|
2032
2054
|
this.communication = new DIVECommunication(this.renderer, this.scene, this.orbitControls, this.toolbox);
|
|
2033
|
-
this.animationSystem = null;
|
|
2034
2055
|
if (this._settings.displayAxes) {
|
|
2035
2056
|
this.axisCamera = new DIVEAxisCamera(this.renderer, this.scene, this.orbitControls);
|
|
2036
2057
|
} else {
|
|
@@ -2051,6 +2072,7 @@ var DIVE = class _DIVE {
|
|
|
2051
2072
|
this.removeResizeObserver();
|
|
2052
2073
|
this.renderer.Dispose();
|
|
2053
2074
|
(_a = this.axisCamera) == null ? void 0 : _a.Dispose();
|
|
2075
|
+
this.animationSystem.Dispose();
|
|
2054
2076
|
this.toolbox.Dispose();
|
|
2055
2077
|
this.communication.DestroyInstance();
|
|
2056
2078
|
}
|