shop-components 0.1.62 → 0.1.64
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.
|
@@ -54,8 +54,11 @@ export declare class OrbitControlsGizmo {
|
|
|
54
54
|
_emitter: EventEmitter<string | symbol, any>;
|
|
55
55
|
addListener: <T extends string | symbol>(event: T, fn: (...args: any[]) => void, context?: any) => EventEmitter<string | symbol, any>;
|
|
56
56
|
removeAllListeners: (event?: string | symbol | undefined) => EventEmitter<string | symbol, any>;
|
|
57
|
+
private _text;
|
|
58
|
+
private _textTimer;
|
|
57
59
|
constructor(orbitControls: OrbitControls, options: OrbitControlsGizmoProps);
|
|
58
|
-
|
|
60
|
+
appendTo(parent: HTMLElement): void;
|
|
61
|
+
private _update;
|
|
59
62
|
private createAxes;
|
|
60
63
|
private createCanvas;
|
|
61
64
|
private onPointerDown;
|
package/dist/shop-components.mjs
CHANGED
|
@@ -65027,10 +65027,12 @@ class OF {
|
|
|
65027
65027
|
}
|
|
65028
65028
|
class qF {
|
|
65029
65029
|
constructor(A, e) {
|
|
65030
|
-
this.lock = !1, this.lockX = !1, this.lockY = !1, this.invRotMat = new zA(), this.mouse = new L(), this.rotateStart = new uA(), this.rotateEnd = new uA(), this.rotateDelta = new uA(), this.selectedAxis = null, this.isDragging = !1, this.context = null, this.orbitState = !0, this._animator = 0, this._emitter = new ar(), this.addListener = this._emitter.addListener.bind(this._emitter), this.removeAllListeners = this._emitter.removeAllListeners.bind(this._emitter), this.
|
|
65031
|
-
this.lock || (this.
|
|
65030
|
+
this.lock = !1, this.lockX = !1, this.lockY = !1, this.invRotMat = new zA(), this.mouse = new L(), this.rotateStart = new uA(), this.rotateEnd = new uA(), this.rotateDelta = new uA(), this.selectedAxis = null, this.isDragging = !1, this.context = null, this.orbitState = !0, this._animator = 0, this._emitter = new ar(), this.addListener = this._emitter.addListener.bind(this._emitter), this.removeAllListeners = this._emitter.removeAllListeners.bind(this._emitter), this._text = document.createElement("div"), this._textTimer = 0, this._update = () => {
|
|
65031
|
+
this.lock || (this._textTimer && (window.clearTimeout(this._textTimer), this._textTimer = 0), this._textTimer = window.setTimeout(() => {
|
|
65032
|
+
this._text.style.opacity = "0";
|
|
65033
|
+
}, 800), this.camera.updateMatrix(), this.invRotMat.extractRotation(this.camera.matrix).invert(), this.axes.forEach((i) => {
|
|
65032
65034
|
this.setAxisPosition(i);
|
|
65033
|
-
}), this.axes.sort((i, r) => i.position.z > r.position.z ? 1 : -1), this.drawLayers(!0));
|
|
65035
|
+
}), this.axes.sort((i, r) => i.position.z > r.position.z ? 1 : -1), this.drawLayers(!0), this._text.style.opacity = "1", this._text.innerText = this.camera.position.distanceTo(this.orbit.target).toFixed(2) + " m");
|
|
65034
65036
|
}, this.onPointerDown = (i) => {
|
|
65035
65037
|
this.rotateStart.set(i.clientX, i.clientY), this.orbitState = this.orbit.enabled, this.orbit.enabled = !1, window.addEventListener("pointermove", this.onDrag, !1), window.addEventListener("pointerup", this.onPointerUp, !1);
|
|
65036
65038
|
}, this.onPointerUp = () => {
|
|
@@ -65110,7 +65112,20 @@ class qF {
|
|
|
65110
65112
|
this.options = {
|
|
65111
65113
|
...t,
|
|
65112
65114
|
...e
|
|
65113
|
-
}, this.orbit = A, this.camera = A.object, this.center = new L(this.options.size / 2, this.options.size / 2, 0), this.axes = this.createAxes(), this.domElement = this.createCanvas(this.options), this.orbit.addEventListener("change", this.
|
|
65115
|
+
}, console.log(this.options), this.orbit = A, this.camera = A.object, this.center = new L(this.options.size / 2, this.options.size / 2, 0), this.axes = this.createAxes(), this.domElement = this.createCanvas(this.options), this.orbit.addEventListener("change", this._update), this._text.style.cssText = `
|
|
65116
|
+
transition: all 0.8s ease-in-out;
|
|
65117
|
+
color: rgb(68, 78, 105);
|
|
65118
|
+
position: absolute;
|
|
65119
|
+
right: ${this.options.offset.x + this.options.size / 4}px;
|
|
65120
|
+
top: ${this.options.offset.y + this.options.size / 2 + 2}px;
|
|
65121
|
+
width: ${this.options.size / 2}px;
|
|
65122
|
+
margin-right: ${-this.options.size / 4}px;
|
|
65123
|
+
font-size: 12px;
|
|
65124
|
+
text-align:center;
|
|
65125
|
+
`;
|
|
65126
|
+
}
|
|
65127
|
+
appendTo(A) {
|
|
65128
|
+
A.append(this.domElement), A.append(this._text);
|
|
65114
65129
|
}
|
|
65115
65130
|
createAxes() {
|
|
65116
65131
|
const {
|
|
@@ -65188,7 +65203,7 @@ class qF {
|
|
|
65188
65203
|
`, e.addEventListener("pointerdown", this.onPointerDown, !1), e.addEventListener("pointerenter", this.onPointerEnter, !1), e.addEventListener("pointermove", this.onPointerMove, !1), e.addEventListener("click", this.onMouseClick, !1), this.context = e.getContext("2d"), e;
|
|
65189
65204
|
}
|
|
65190
65205
|
destroy() {
|
|
65191
|
-
cancelAnimationFrame(this._animator), this.orbit.enabled = this.orbitState, window.removeEventListener("pointermove", this.onDrag, !1), window.removeEventListener("pointerup", this.onPointerUp, !1), this._emitter.removeAllListeners(), this.domElement.addEventListener("pointerdown", this.onPointerDown, !1), this.domElement.addEventListener("pointerenter", this.onPointerEnter, !1), this.domElement.addEventListener("pointermove", this.onPointerMove, !1), this.domElement.addEventListener("click", this.onMouseClick, !1), this.domElement.remove();
|
|
65206
|
+
cancelAnimationFrame(this._animator), this.orbit.removeEventListener("change", this._update), this.orbit.enabled = this.orbitState, window.removeEventListener("pointermove", this.onDrag, !1), window.removeEventListener("pointerup", this.onPointerUp, !1), this._emitter.removeAllListeners(), this.domElement.addEventListener("pointerdown", this.onPointerDown, !1), this.domElement.addEventListener("pointerenter", this.onPointerEnter, !1), this.domElement.addEventListener("pointermove", this.onPointerMove, !1), this.domElement.addEventListener("click", this.onMouseClick, !1), this.domElement.remove(), window.clearTimeout(this._textTimer), this._text.remove();
|
|
65192
65207
|
}
|
|
65193
65208
|
}
|
|
65194
65209
|
const NF = new OF(), rH = new kO(_R);
|
|
@@ -65250,7 +65265,7 @@ class sH {
|
|
|
65250
65265
|
let { top: r, left: s } = this.renderer.domElement.getBoundingClientRect();
|
|
65251
65266
|
this.offset.set(s, r), this.mousePos.set(i.clientX - s, i.clientY - r), this.mouseCoord.set(
|
|
65252
65267
|
(i.clientX - s) / this.size.x * 2 - 1,
|
|
65253
|
-
-((i.clientY - r) /
|
|
65268
|
+
-((i.clientY - r) / this.size.y) * 2 + 1
|
|
65254
65269
|
), this._raycaster.setFromCamera(this.mouseCoord, this.camera);
|
|
65255
65270
|
}, this._pointerdown = (i) => {
|
|
65256
65271
|
const r = () => {
|
|
@@ -65330,7 +65345,7 @@ class sH {
|
|
|
65330
65345
|
let t = window.devicePixelRatio;
|
|
65331
65346
|
t < 2 && (t = 2), this.pathTracer.renderScale = t, this.pathTracer.bounces = 10, this.pathTracer.transmissiveBounces = 3, this.pathTracer.tiles.set(e, e), this.pathTracer.fadeDuration = 0, this.pathTracer.setBVHWorker(new vF()), this.orthographicCamera.left = -20, this.orthographicCamera.right = 20, this.orthographicCamera.top = -20, this.orthographicCamera.bottom = 20, this.controls.addEventListener("change", () => {
|
|
65332
65347
|
var i;
|
|
65333
|
-
this.sampleCount = 0, this.orthographicCamera.position.copy(this.camera.position), this.orthographicCamera.lookAt(this.controls.target), this.usePathTracing && (this.pathTracer.pausePathTracing = !1, (i = this.pathTracer) == null || i.updateCamera()), this._updateCamera(), this._axisMoving || (this.mainCamera = this.camera);
|
|
65348
|
+
this.sampleCount = 0, this.orthographicCamera.position.copy(this.camera.position), this.orthographicCamera.lookAt(this.controls.target), this.usePathTracing && (this.pathTracer.pausePathTracing = !1, (i = this.pathTracer) == null || i.updateCamera()), this._updateCamera(), !(Math.abs(this.camera.position.x) < 1e-3 || Math.abs(this.camera.position.z) < 1e-3) && (this._axisMoving || (this.mainCamera = this.camera));
|
|
65334
65349
|
}), this.mainCamera = this.camera, this._composer = new zO(this.renderer), this._composer.setPixelRatio(window.devicePixelRatio), this._composer.addPass(new jE(this.scene, this.camera)), this._composer.addPass(new YE()), this._outlinePass = new Zn(new uA(window.innerWidth, window.innerHeight), this.scene, this.camera), this._outlinePass.visibleEdgeColor.set(26367), this._outlinePass.edgeThickness = 0.5, this._outlinePass.hiddenEdgeColor.set(26367), this._outlinePass.edgeStrength = 3, this._outlinePass.edgeGlow = 0, this._composer.addPass(this._outlinePass), this._outlinePassError = new Zn(new uA(window.innerWidth, window.innerHeight), this.scene, this.camera), this._outlinePassError.visibleEdgeColor.set(16711680), this._outlinePassError.edgeThickness = 0.5, this._outlinePassError.hiddenEdgeColor.set(16711680), this._outlinePassError.edgeStrength = 3, this._outlinePassError.edgeGlow = 0, this._composer.addPass(this._outlinePassError), this._composer.renderTarget1.texture.colorSpace = ke, this._composer.renderTarget2.texture.colorSpace = ke, this._fxaaPass = new Z2(KE), this._composer.addPass(this._fxaaPass), this._container.add(this.amr), this.scene.add(this._container), this.ticker(), this._loadEnv(), this._initEvents(), this._ground.rotateX(-Math.PI / 2), this.scene.add(this._ground), (typeof A.useAxisBall != "boolean" || A.useAxisBall) && (this._controlsGizmo = new qF(this.controls, {
|
|
65335
65350
|
size: 160,
|
|
65336
65351
|
padding: 12,
|
|
@@ -65363,7 +65378,7 @@ class sH {
|
|
|
65363
65378
|
this.stats.dom.style.display = "none";
|
|
65364
65379
|
}
|
|
65365
65380
|
_updateCamera() {
|
|
65366
|
-
const A = this.mainCamera.position.distanceTo(this.controls.target), e = 2 * Math.tan(this.camera.fov * 0.5 * Math.PI / 180) * A, t =
|
|
65381
|
+
const A = this.mainCamera.position.distanceTo(this.controls.target), e = 2 * Math.tan(this.camera.fov * 0.5 * Math.PI / 180) * A, t = this.size.x / this.size.y;
|
|
65367
65382
|
this.orthographicCamera.left = -e * t / 2, this.orthographicCamera.right = e * t / 2, this.orthographicCamera.top = e / 2, this.orthographicCamera.bottom = -e / 2, this.orthographicCamera.updateProjectionMatrix();
|
|
65368
65383
|
}
|
|
65369
65384
|
_loadEnv() {
|
|
@@ -65448,7 +65463,7 @@ class sH {
|
|
|
65448
65463
|
typeof A == "string" || (Array.isArray(A) ? this._outlinePass.selectedObjects = [...A] : this._outlinePass.selectedObjects = [A]);
|
|
65449
65464
|
}
|
|
65450
65465
|
appendTo(A) {
|
|
65451
|
-
A.append(this.renderer.domElement), A.append(this.stats.dom), A.append(this.lines), A.append(this.css2dRenderer.domElement), this._controlsGizmo &&
|
|
65466
|
+
A.append(this.renderer.domElement), A.append(this.stats.dom), A.append(this.lines), A.append(this.css2dRenderer.domElement), this._controlsGizmo && this._controlsGizmo.appendTo(A), this.stats.dom.style.bottom = "0", this.stats.dom.style.top = "auto", this.resize(), this._resizeObserver = new ResizeObserver(this.resize.bind(this)), this._resizeObserver.observe(A);
|
|
65452
65467
|
}
|
|
65453
65468
|
add(A) {
|
|
65454
65469
|
this._container.add(A);
|