@pacem/pacem 1.0.0-euler → 1.0.0-galois
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/browser/pacem-2d.js +1 -1
- package/dist/browser/pacem-2d.min.js +1 -1
- package/dist/browser/pacem-3d.js +4 -2
- package/dist/browser/pacem-3d.js.map +1 -1
- package/dist/browser/pacem-3d.min.js +2 -2
- package/dist/browser/pacem-charts.js +1 -1
- package/dist/browser/pacem-charts.min.js +1 -1
- package/dist/browser/pacem-cms.js +1 -1
- package/dist/browser/pacem-cms.min.js +1 -1
- package/dist/browser/pacem-core.js +1 -1
- package/dist/browser/pacem-core.min.js +1 -1
- package/dist/browser/pacem-foundation.js +1 -1
- package/dist/browser/pacem-foundation.min.js +1 -1
- package/dist/browser/pacem-fx.js +1 -1
- package/dist/browser/pacem-fx.min.js +1 -1
- package/dist/browser/pacem-logging.js +1 -1
- package/dist/browser/pacem-logging.min.js +1 -1
- package/dist/browser/pacem-maps.js +1 -1
- package/dist/browser/pacem-maps.min.js +1 -1
- package/dist/browser/pacem-media.js +1 -1
- package/dist/browser/pacem-media.min.js +1 -1
- package/dist/browser/pacem-networking.js +1 -1
- package/dist/browser/pacem-networking.min.js +1 -1
- package/dist/browser/pacem-numerical.js +1 -1
- package/dist/browser/pacem-numerical.min.js +1 -1
- package/dist/browser/pacem-plus.js +2 -2
- package/dist/browser/pacem-plus.js.map +1 -1
- package/dist/browser/pacem-plus.min.js +2 -2
- package/dist/browser/pacem-scaffolding.js +66 -23
- package/dist/browser/pacem-scaffolding.js.map +1 -1
- package/dist/browser/pacem-scaffolding.min.js +2 -2
- package/dist/browser/pacem-ui.js +47 -34
- package/dist/browser/pacem-ui.js.map +1 -1
- package/dist/browser/pacem-ui.min.js +2 -2
- package/dist/bundle/pacem.min.mjs +144 -144
- package/dist/bundle/pacem.mjs +104 -51
- package/dist/bundle/pacem.mjs.map +2 -2
- package/dist/docs/pacem-ui.json +96 -0
- package/dist/typings/index.d.ts +6 -2
- package/dist/vscode.html-custom.json +1 -1
- package/package.json +1 -1
package/dist/docs/pacem-ui.json
CHANGED
|
@@ -12846,6 +12846,102 @@
|
|
|
12846
12846
|
"isAbstract": false,
|
|
12847
12847
|
"name": "disconnectedCallback"
|
|
12848
12848
|
},
|
|
12849
|
+
{
|
|
12850
|
+
"kind": "Method",
|
|
12851
|
+
"canonicalReference": "@pacem/pacem-ui!Components.UI.PacemMenuCursorElement#propertyChangedCallback:member(1)",
|
|
12852
|
+
"docComment": "",
|
|
12853
|
+
"excerptTokens": [
|
|
12854
|
+
{
|
|
12855
|
+
"kind": "Content",
|
|
12856
|
+
"text": "propertyChangedCallback(name: "
|
|
12857
|
+
},
|
|
12858
|
+
{
|
|
12859
|
+
"kind": "Content",
|
|
12860
|
+
"text": "string"
|
|
12861
|
+
},
|
|
12862
|
+
{
|
|
12863
|
+
"kind": "Content",
|
|
12864
|
+
"text": ", old: "
|
|
12865
|
+
},
|
|
12866
|
+
{
|
|
12867
|
+
"kind": "Content",
|
|
12868
|
+
"text": "any"
|
|
12869
|
+
},
|
|
12870
|
+
{
|
|
12871
|
+
"kind": "Content",
|
|
12872
|
+
"text": ", val: "
|
|
12873
|
+
},
|
|
12874
|
+
{
|
|
12875
|
+
"kind": "Content",
|
|
12876
|
+
"text": "any"
|
|
12877
|
+
},
|
|
12878
|
+
{
|
|
12879
|
+
"kind": "Content",
|
|
12880
|
+
"text": ", first: "
|
|
12881
|
+
},
|
|
12882
|
+
{
|
|
12883
|
+
"kind": "Content",
|
|
12884
|
+
"text": "boolean"
|
|
12885
|
+
},
|
|
12886
|
+
{
|
|
12887
|
+
"kind": "Content",
|
|
12888
|
+
"text": "): "
|
|
12889
|
+
},
|
|
12890
|
+
{
|
|
12891
|
+
"kind": "Content",
|
|
12892
|
+
"text": "void"
|
|
12893
|
+
},
|
|
12894
|
+
{
|
|
12895
|
+
"kind": "Content",
|
|
12896
|
+
"text": ";"
|
|
12897
|
+
}
|
|
12898
|
+
],
|
|
12899
|
+
"isStatic": false,
|
|
12900
|
+
"returnTypeTokenRange": {
|
|
12901
|
+
"startIndex": 9,
|
|
12902
|
+
"endIndex": 10
|
|
12903
|
+
},
|
|
12904
|
+
"releaseTag": "Public",
|
|
12905
|
+
"isProtected": false,
|
|
12906
|
+
"overloadIndex": 1,
|
|
12907
|
+
"parameters": [
|
|
12908
|
+
{
|
|
12909
|
+
"parameterName": "name",
|
|
12910
|
+
"parameterTypeTokenRange": {
|
|
12911
|
+
"startIndex": 1,
|
|
12912
|
+
"endIndex": 2
|
|
12913
|
+
},
|
|
12914
|
+
"isOptional": false
|
|
12915
|
+
},
|
|
12916
|
+
{
|
|
12917
|
+
"parameterName": "old",
|
|
12918
|
+
"parameterTypeTokenRange": {
|
|
12919
|
+
"startIndex": 3,
|
|
12920
|
+
"endIndex": 4
|
|
12921
|
+
},
|
|
12922
|
+
"isOptional": false
|
|
12923
|
+
},
|
|
12924
|
+
{
|
|
12925
|
+
"parameterName": "val",
|
|
12926
|
+
"parameterTypeTokenRange": {
|
|
12927
|
+
"startIndex": 5,
|
|
12928
|
+
"endIndex": 6
|
|
12929
|
+
},
|
|
12930
|
+
"isOptional": false
|
|
12931
|
+
},
|
|
12932
|
+
{
|
|
12933
|
+
"parameterName": "first",
|
|
12934
|
+
"parameterTypeTokenRange": {
|
|
12935
|
+
"startIndex": 7,
|
|
12936
|
+
"endIndex": 8
|
|
12937
|
+
},
|
|
12938
|
+
"isOptional": false
|
|
12939
|
+
}
|
|
12940
|
+
],
|
|
12941
|
+
"isOptional": false,
|
|
12942
|
+
"isAbstract": false,
|
|
12943
|
+
"name": "propertyChangedCallback"
|
|
12944
|
+
},
|
|
12849
12945
|
{
|
|
12850
12946
|
"kind": "Method",
|
|
12851
12947
|
"canonicalReference": "@pacem/pacem-ui!Components.UI.PacemMenuCursorElement#viewActivatedCallback:member(1)",
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pacem/pacem v1.0.0-
|
|
2
|
+
* @pacem/pacem v1.0.0-galois (https://js.pacem.it)
|
|
3
3
|
* Pacem (https://pacem.it)
|
|
4
4
|
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
@@ -8168,9 +8168,11 @@ declare class PacemHierarchyElement extends PacemBaseElement {
|
|
|
8168
8168
|
private _buildHierarchyItemDomId;
|
|
8169
8169
|
private _itemCreate;
|
|
8170
8170
|
private _itemRemove;
|
|
8171
|
+
private _disposeBinders;
|
|
8172
|
+
private _disposeBindersAndTargets;
|
|
8171
8173
|
private _setupItemTemplate;
|
|
8172
8174
|
private _compileHierarchy;
|
|
8173
|
-
private
|
|
8175
|
+
private _tidyUpHierarchy;
|
|
8174
8176
|
private _dragInitHandler;
|
|
8175
8177
|
private _dragStartHandler;
|
|
8176
8178
|
private _dragHandler;
|
|
@@ -9116,6 +9118,8 @@ declare class PacemMenuCursorElement extends Components_2.PacemElement {
|
|
|
9116
9118
|
viewActivatedCallback(): void;
|
|
9117
9119
|
connectedCallback(): void;
|
|
9118
9120
|
disconnectedCallback(): void;
|
|
9121
|
+
propertyChangedCallback(name: string, old: any, val: any, first: boolean): void;
|
|
9122
|
+
private _findAnchorAndScrollItIntoView;
|
|
9119
9123
|
private _onPathChange;
|
|
9120
9124
|
}
|
|
9121
9125
|
|
|
@@ -359,7 +359,7 @@
|
|
|
359
359
|
"name": "pacem-3d-orbit-camera",
|
|
360
360
|
"description": {
|
|
361
361
|
"kind": "markdown",
|
|
362
|
-
"value": "**@pacem/pacem-3d**\n\nTries to attach a new {@link OrbitCameraBehavior} to the provided element, if the element is a proper renderable and it is ready. @param element @returns / static tryAttach(element: any, config?: OrbitCameraConfiguration): OrbitCameraBehavior | null { config ??= DEFAULT_CONFIGURATION; const canvas = findCameraStage(element)?.stage; if (!Utils.isNull(canvas)) { const { position, lookAt } = <Camera>element; if (Utils.isNull(position) || Utils.isNull(lookAt) || Vector3D.areClose(position, lookAt)) { return null; } return new OrbitCameraBehavior(element, config); } else { return null; } } /** State of the current configuration, obtained from the interaction inputs. */ private _input: OrbitCameraInputState = { /** Zoom/scale */ rho: 0, /** Azimuth (rotation around x axis in webgpu) */ theta: 0, /** Polar (rotation around y axis in webgpu) */ phi: 0, /** pan/offset x*/ x: 0, /** pan/offset y*/ y: 0, }; /** Sibling state of {@link _input} that comes helpful when inertia is involved. */ private _progress: OrbitCameraInputState = { rho: 0, theta: 0, phi: 0, x: 0, y: 0, }; get configuration() { return this._config; } set configuration(v: OrbitCameraConfiguration) { this._config = v; } #panning: boolean; #rotating: boolean; private _startHandler = (evt: PointerEvent) => { const { rotation, pan } = this._config; const isMouse = evt.pointerType === 'mouse'; const rotating = rotation.enabled && isMouse && evt.button === rotation.button && CustomEventUtils.matchModifiers(evt, rotation.modifiers); const panning = pan.enabled && isMouse && evt.button === pan.button && CustomEventUtils.matchModifiers(evt, pan.modifiers); if (!rotating && !panning) { return; } this.#rotating = rotating; if (this.#panning = panning) { // build current state from the current camera configuration this._currentState = OrbitCameraBehavior._buildState(this._camera); // reset pan offsets Utils.extend(this._input, Vector3D.zero()); this._progress.x = this._progress.y = 0; } avoidHandler(evt); window.addEventListener('pointerup', this._endHandler, false); window.addEventListener('pointermove', this._moveHandler, false); window.addEventListener('contextmenu', this._avoidHandler, false); }; private _avoidHandler = (evt: Event) => avoidHandler(evt); private _endHandler = (evt: PointerEvent) => { avoidHandler(evt); // delay the listener removals a bit (~frame) window.setTimeout(() => { window.removeEventListener('pointerup', this._endHandler); window.removeEventListener('pointermove', this._moveHandler); window.removeEventListener('contextmenu', this._avoidHandler); }, 20); }; private _zoomHandler = (evt: WheelEvent) => { const { zoom } = this._config; const zooming = zoom.enabled && CustomEventUtils.matchModifiers(evt, zoom.modifiers); if (!zooming) { return; } avoidHandler(evt); const coords = this._input; coords.rho -= Math.sign(evt.deltaY); }; private _moveHandler = (evt: PointerEvent) => { avoidHandler(evt); const { height, width } = this._scene.size; const coords = this._input; const size = Math.min(height, width); if (this.#rotating) { // rotation const f0 = -ROTATION_FACTOR * 360 / size; const { phi, theta } = coords; const { maxPolar, minPolar, maxAzimuth, minAzimuth } = this._config; coords.phi = (phi + evt.movementX * f0).clamp(minPolar, maxPolar); coords.theta = (theta + evt.movementY * f0).clamp(minAzimuth, maxAzimuth); } else if (this.#panning) { // pan const f0 = this._currentState.radius / size; coords.x += -evt.movementX * f0; coords.y += evt.movementY * f0; } }; private _getSafeAzimuth({ theta }: Partial<Spherical>): number { return OrbitCameraBehavior._modAngle(theta); } private _getSafePolar({ phi }: Partial<Spherical>): number { return OrbitCameraBehavior._modAngle(phi); } private static _modAngle(deg: number): number { while (deg < 0) { deg += 360; } return deg % 360; } private static _getViewXYZ(state: OrbitCameraState): { right: Vector3D, up: Vector3D, versor: Vector3D } { const { versor, up: initUp } = state; const right = Vector3D.cross(versor, initUp); const up = Vector3D.cross(right, versor); Vector3D.normalize(right); Vector3D.normalize(up); return { right, up, versor }; } #updating: boolean; private _update() { if (this.#updating) { return; } this.#updating = true; const camera = this._camera; const { radius, versor, target: initTarget, up: initUp } = this._initialState; const { target: trackedLookAt } = this._currentState; const { theta, phi, rho, x, y } = this._input; const progress = this._progress; const { theta: theta_, phi: phi_, rho: rho_, x: x_, y: y_ } = progress; const rotated = Math.abs(phi_ - phi) > EPSILON || Math.abs(theta_ - theta) > EPSILON, zoomed = Math.abs(rho_ - rho) > EPSILON, panned = Math.abs(x - x_) > EPSILON || Math.abs(y - y_) > EPSILON; if (zoomed || rotated || panned) { const inertia = typeof this._config.inertia === 'boolean' ? (this._config.inertia ? FRICTION_FACTOR : 0) : this._config.inertia; const inertiaSpecified = inertia > 0 && inertia < 1; const { right, up } = OrbitCameraBehavior._getViewXYZ(this._initialState); // setup position let newPosition: Vector3D = initTarget; let newUp: Vector3D = initUp; let newLookAt: Vector3D = trackedLookAt; //if (zoomed) { 2 let rho0 = rho_; if (inertiaSpecified) { rho0 += (rho - rho_) * inertia; } else { rho0 = rho; } progress.rho = rho0; const scale = Math.pow(.95, rho0 * ZOOM_FACTOR); const zoom = Vector3D.scale(versor, -scale * radius); newPosition = Vector3D.add(newPosition, zoom); //} //if (rotated) { 3 let phi0 = phi_; let theta0 = theta_; if (inertiaSpecified) { phi0 += (phi - phi_) * inertia; theta0 += (theta - theta_) * inertia; } else { phi0 = phi; theta0 = theta; } const PHI = this._getSafePolar({ phi: progress.phi = phi0 }); const THETA = this._getSafeAzimuth({ theta: progress.theta = theta0 }); // pivot of the rotation matrix should be the center of the bounding sphere const pivot = Vector3D.negate(initTarget); let m = Matrix3D.translate(Matrix3D.identity(), pivot); const qy = Quaternion.fromAxisAngle(up, PHI); const qx = Quaternion.fromAxisAngle(right, THETA); const rot = Matrix3D.multiply(Quaternion.toRotationMatrix(qx), Quaternion.toRotationMatrix(qy)); m = Matrix3D.multiply(m, rot); m = Matrix3D.translate(m, Vector3D.negate(pivot)); newPosition = Matrix3D.transform(newPosition, m); newUp = Matrix3D.transform(newUp, Matrix3D.clone(m, m0 => { m0.offsetX = m0.offsetY = m0.offsetZ = 0; })); //} //if (panned){ 1 const x1 = x_, y1 = y_; let x0 = x1, y0 = y1; if (inertiaSpecified) { x0 += (x - x1) * inertia; y0 += (y - y1) * inertia; } else { x0 = x; y0 = y; } progress.x = x0; progress.y = y0; const { right: currentRight, up: currentUp } = OrbitCameraBehavior._getViewXYZ(this._currentState); const r = Vector3D.scale(currentRight, x0), u = Vector3D.scale(currentUp, y0); const offset = Vector3D.add(r, u); newLookAt = Vector3D.add(trackedLookAt, offset); camera.lookAt = newLookAt; camera.position = newPosition; // Vector3D.add(newPosition, Vector3D.subtract(initTarget, newLookAt)); camera.up = newUp; // notify something has changed about the target renderable camera.flags.push(StalePropertyFlag.Camera); } this.#updating = false; } private _renderHandler = (_: Event) => { this._update(); }; /** Detaches and removes handlers and resources. */ dispose() { const canvas = this._canvas, scene = this._scene; if (!Utils.isNull(canvas)) { canvas.removeEventListener('pointerdown', this._startHandler); canvas.removeEventListener('wheel', this._zoomHandler); } scene.removeEventListener('render', this._renderHandler, false); } } /** `<pacem-3d-orbit-camera>`: a behavior element that, applied to a {@link Pacem3DCameraElement}, attaches pointer/wheel driven orbit (rotate/pan/zoom around a target) interaction by instantiating and configuring an {@link OrbitCameraBehavior} for each decorated element."
|
|
362
|
+
"value": "**@pacem/pacem-3d**\n\nTries to attach a new {@link OrbitCameraBehavior} to the provided element, if the element is a proper renderable and it is ready. @param element @returns / static tryAttach(element: any, config?: OrbitCameraConfiguration): OrbitCameraBehavior | null { config ??= DEFAULT_CONFIGURATION; const canvas = findCameraStage(element)?.stage; if (!Utils.isNull(canvas)) { const { position, lookAt } = <Camera>element; if (Utils.isNull(position) || Utils.isNull(lookAt) || Vector3D.areClose(position, lookAt)) { return null; } return new OrbitCameraBehavior(element, config); } else { return null; } } /** State of the current configuration, obtained from the interaction inputs. */ private _input: OrbitCameraInputState = { /** Zoom/scale */ rho: 0, /** Azimuth (rotation around x axis in webgpu) */ theta: 0, /** Polar (rotation around y axis in webgpu) */ phi: 0, /** pan/offset x*/ x: 0, /** pan/offset y*/ y: 0, }; /** Sibling state of {@link _input} that comes helpful when inertia is involved. */ private _progress: OrbitCameraInputState = { rho: 0, theta: 0, phi: 0, x: 0, y: 0, }; get configuration() { return this._config; } set configuration(v: OrbitCameraConfiguration) { this._config = v; } #panning: boolean; #rotating: boolean; #handle: number; private _startHandler = (evt: PointerEvent) => { const { rotation, pan } = this._config; const isMouse = evt.pointerType === 'mouse'; const rotating = rotation.enabled && isMouse && evt.button === rotation.button && CustomEventUtils.matchModifiers(evt, rotation.modifiers); const panning = pan.enabled && isMouse && evt.button === pan.button && CustomEventUtils.matchModifiers(evt, pan.modifiers); if (!rotating && !panning) { return; } this.#rotating = rotating; if (this.#panning = panning) { // build current state from the current camera configuration this._currentState = OrbitCameraBehavior._buildState(this._camera); // reset pan offsets Utils.extend(this._input, Vector3D.zero()); this._progress.x = this._progress.y = 0; } avoidHandler(evt); window.clearTimeout(this.#handle); window.addEventListener('pointerup', this._endHandler, false); window.addEventListener('pointermove', this._moveHandler, false); window.addEventListener('contextmenu', this._avoidHandler, false); }; private _avoidHandler = (evt: Event) => avoidHandler(evt); private _endHandler = (evt: PointerEvent) => { avoidHandler(evt); // delay the listener removals a bit (~frame) this.#handle = window.setTimeout(() => { window.removeEventListener('pointerup', this._endHandler); window.removeEventListener('pointermove', this._moveHandler); window.removeEventListener('contextmenu', this._avoidHandler); }, 20); }; private _zoomHandler = (evt: WheelEvent) => { const { zoom } = this._config; const zooming = zoom.enabled && CustomEventUtils.matchModifiers(evt, zoom.modifiers); if (!zooming) { return; } avoidHandler(evt); const coords = this._input; coords.rho -= Math.sign(evt.deltaY); }; private _moveHandler = (evt: PointerEvent) => { avoidHandler(evt); const { height, width } = this._scene.size; const coords = this._input; const size = Math.min(height, width); if (this.#rotating) { // rotation const f0 = -ROTATION_FACTOR * 360 / size; const { phi, theta } = coords; const { maxPolar, minPolar, maxAzimuth, minAzimuth } = this._config; coords.phi = (phi + evt.movementX * f0).clamp(minPolar, maxPolar); coords.theta = (theta + evt.movementY * f0).clamp(minAzimuth, maxAzimuth); } else if (this.#panning) { // pan const f0 = this._currentState.radius / size; coords.x += -evt.movementX * f0; coords.y += evt.movementY * f0; } }; private _getSafeAzimuth({ theta }: Partial<Spherical>): number { return OrbitCameraBehavior._modAngle(theta); } private _getSafePolar({ phi }: Partial<Spherical>): number { return OrbitCameraBehavior._modAngle(phi); } private static _modAngle(deg: number): number { while (deg < 0) { deg += 360; } return deg % 360; } private static _getViewXYZ(state: OrbitCameraState): { right: Vector3D, up: Vector3D, versor: Vector3D } { const { versor, up: initUp } = state; const right = Vector3D.cross(versor, initUp); const up = Vector3D.cross(right, versor); Vector3D.normalize(right); Vector3D.normalize(up); return { right, up, versor }; } #updating: boolean; private _update() { if (this.#updating) { return; } this.#updating = true; const camera = this._camera; const { radius, versor, target: initTarget, up: initUp } = this._initialState; const { target: trackedLookAt } = this._currentState; const { theta, phi, rho, x, y } = this._input; const progress = this._progress; const { theta: theta_, phi: phi_, rho: rho_, x: x_, y: y_ } = progress; const rotated = Math.abs(phi_ - phi) > EPSILON || Math.abs(theta_ - theta) > EPSILON, zoomed = Math.abs(rho_ - rho) > EPSILON, panned = Math.abs(x - x_) > EPSILON || Math.abs(y - y_) > EPSILON; if (zoomed || rotated || panned) { const inertia = typeof this._config.inertia === 'boolean' ? (this._config.inertia ? FRICTION_FACTOR : 0) : this._config.inertia; const inertiaSpecified = inertia > 0 && inertia < 1; const { right, up } = OrbitCameraBehavior._getViewXYZ(this._initialState); // setup position let newPosition: Vector3D = initTarget; let newUp: Vector3D = initUp; let newLookAt: Vector3D = trackedLookAt; //if (zoomed) { 2 let rho0 = rho_; if (inertiaSpecified) { rho0 += (rho - rho_) * inertia; } else { rho0 = rho; } progress.rho = rho0; const scale = Math.pow(.95, rho0 * ZOOM_FACTOR); const zoom = Vector3D.scale(versor, -scale * radius); newPosition = Vector3D.add(newPosition, zoom); //} //if (rotated) { 3 let phi0 = phi_; let theta0 = theta_; if (inertiaSpecified) { phi0 += (phi - phi_) * inertia; theta0 += (theta - theta_) * inertia; } else { phi0 = phi; theta0 = theta; } const PHI = this._getSafePolar({ phi: progress.phi = phi0 }); const THETA = this._getSafeAzimuth({ theta: progress.theta = theta0 }); // pivot of the rotation matrix should be the center of the bounding sphere const pivot = Vector3D.negate(initTarget); let m = Matrix3D.translate(Matrix3D.identity(), pivot); const qy = Quaternion.fromAxisAngle(up, PHI); const qx = Quaternion.fromAxisAngle(right, THETA); const rot = Matrix3D.multiply(Quaternion.toRotationMatrix(qx), Quaternion.toRotationMatrix(qy)); m = Matrix3D.multiply(m, rot); m = Matrix3D.translate(m, Vector3D.negate(pivot)); newPosition = Matrix3D.transform(newPosition, m); newUp = Matrix3D.transform(newUp, Matrix3D.clone(m, m0 => { m0.offsetX = m0.offsetY = m0.offsetZ = 0; })); //} //if (panned){ 1 const x1 = x_, y1 = y_; let x0 = x1, y0 = y1; if (inertiaSpecified) { x0 += (x - x1) * inertia; y0 += (y - y1) * inertia; } else { x0 = x; y0 = y; } progress.x = x0; progress.y = y0; const { right: currentRight, up: currentUp } = OrbitCameraBehavior._getViewXYZ(this._currentState); const r = Vector3D.scale(currentRight, x0), u = Vector3D.scale(currentUp, y0); const offset = Vector3D.add(r, u); newLookAt = Vector3D.add(trackedLookAt, offset); camera.lookAt = newLookAt; camera.position = newPosition; // Vector3D.add(newPosition, Vector3D.subtract(initTarget, newLookAt)); camera.up = newUp; // notify something has changed about the target renderable camera.flags.push(StalePropertyFlag.Camera); } this.#updating = false; } private _renderHandler = (_: Event) => { this._update(); }; /** Detaches and removes handlers and resources. */ dispose() { const canvas = this._canvas, scene = this._scene; if (!Utils.isNull(canvas)) { canvas.removeEventListener('pointerdown', this._startHandler); canvas.removeEventListener('wheel', this._zoomHandler); } scene.removeEventListener('render', this._renderHandler, false); } } /** `<pacem-3d-orbit-camera>`: a behavior element that, applied to a {@link Pacem3DCameraElement}, attaches pointer/wheel driven orbit (rotate/pan/zoom around a target) interaction by instantiating and configuring an {@link OrbitCameraBehavior} for each decorated element."
|
|
363
363
|
},
|
|
364
364
|
"attributes": [
|
|
365
365
|
{
|
package/package.json
CHANGED