@shapediver/viewer.rendering-engine.camera-engine
Advanced tools
Comparing version 2.9.2 to 2.9.3
@@ -11,3 +11,3 @@ import { SettingsEngine } from '@shapediver/viewer.shared.services'; | ||
protected _controls: IPerspectiveCameraControls; | ||
constructor(id: string, version?: string); | ||
constructor(id: string, version?: string, initialAspect?: number); | ||
get aspect(): number | undefined; | ||
@@ -14,0 +14,0 @@ set aspect(value: number | undefined); |
@@ -11,7 +11,2 @@ "use strict"; | ||
}; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
@@ -23,2 +18,7 @@ if (kind === "m") throw new TypeError("Private method is not writable"); | ||
}; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var _PerspectiveCamera_converter, _PerspectiveCamera_logger, _PerspectiveCamera_tree, _PerspectiveCamera_domEventListenerToken, _PerspectiveCamera_domEventEngine, _PerspectiveCamera_aspect, _PerspectiveCamera_fov, _PerspectiveCamera_threeJsObject; | ||
@@ -37,3 +37,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
// #region Constructors (1) | ||
constructor(id, version) { | ||
constructor(id, version, initialAspect) { | ||
super(id, ICameraEngine_1.CAMERA_TYPE.PERSPECTIVE, version); | ||
@@ -49,2 +49,3 @@ // #region Properties (3) | ||
_PerspectiveCamera_threeJsObject.set(this, {}); | ||
__classPrivateFieldSet(this, _PerspectiveCamera_aspect, initialAspect, "f"); | ||
this._controls = new PerspectiveCameraControls_1.PerspectiveCameraControls(this, true); | ||
@@ -122,3 +123,3 @@ } | ||
clone() { | ||
return new PerspectiveCamera(this.id, this.version); | ||
return new PerspectiveCamera(this.id, this.version, this.aspect); | ||
} | ||
@@ -125,0 +126,0 @@ calculateZoomTo(zoomTarget, startingPosition = this.position, startingTarget = this.target) { |
@@ -119,3 +119,4 @@ "use strict"; | ||
throw new viewer_shared_services_1.ShapeDiverViewerCameraError(`CameraEngine.createCamera: Camera (${type}) with this id (${cameraId}) already exists.`); | ||
const camera = ICameraEngine_1.CAMERA_TYPE.PERSPECTIVE === type ? new PerspectiveCamera_1.PerspectiveCamera(cameraId) : new OrthographicCamera_1.OrthographicCamera(cameraId); | ||
const initialAspectRatio = this._renderingEngine.canvas.parentNode.clientWidth / this._renderingEngine.canvas.parentNode.clientHeight; | ||
const camera = ICameraEngine_1.CAMERA_TYPE.PERSPECTIVE === type ? new PerspectiveCamera_1.PerspectiveCamera(cameraId, undefined, initialAspectRatio) : new OrthographicCamera_1.OrthographicCamera(cameraId); | ||
camera.assignViewer(this._renderingEngine); | ||
@@ -122,0 +123,0 @@ cameras[cameraId] = camera; |
@@ -38,3 +38,3 @@ "use strict"; | ||
let x1 = x, y1 = y; | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2) { | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2 && event.touches.length >= 2) { | ||
x1 = (event.touches[0].pageX - event.touches[1].pageX) / window.innerWidth * (window.innerWidth / window.innerHeight); | ||
@@ -131,3 +131,3 @@ y1 = (event.touches[0].pageY - event.touches[1].pageY) / window.innerHeight; | ||
let x1 = x, y1 = y; | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2) { | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2 && event.touches.length >= 2) { | ||
x1 = (event.touches[0].pageX - event.touches[1].pageX) / window.innerWidth * (window.innerWidth / window.innerHeight); | ||
@@ -214,2 +214,4 @@ y1 = (event.touches[0].pageY - event.touches[1].pageY) / window.innerHeight; | ||
else { | ||
if (event.touches.length < 1) | ||
return { x: 0, y: 0 }; | ||
return { | ||
@@ -216,0 +218,0 @@ x: event.touches[0].pageX / window.innerWidth * aspect, |
@@ -47,3 +47,3 @@ "use strict"; | ||
let x1 = x, y1 = y; | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2) { | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2 && event.touches.length >= 2) { | ||
x1 = (event.touches[0].pageX - event.touches[1].pageX) / window.innerWidth * (window.innerWidth / window.innerHeight); | ||
@@ -143,3 +143,3 @@ y1 = (event.touches[0].pageY - event.touches[1].pageY) / window.innerHeight; | ||
let x1 = x, y1 = y; | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2) { | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2 && event.touches.length >= 2) { | ||
x1 = (event.touches[0].pageX - event.touches[1].pageX) / window.innerWidth * (window.innerWidth / window.innerHeight); | ||
@@ -231,2 +231,4 @@ y1 = (event.touches[0].pageY - event.touches[1].pageY) / window.innerHeight; | ||
else { | ||
if (event.touches.length < 1) | ||
return { x: 0, y: 0 }; | ||
return { | ||
@@ -233,0 +235,0 @@ x: event.touches[0].pageX / window.innerWidth * aspect, |
{ | ||
"name": "@shapediver/viewer.rendering-engine.camera-engine", | ||
"version": "2.9.2", | ||
"version": "2.9.3", | ||
"description": "", | ||
@@ -42,8 +42,8 @@ "keywords": [], | ||
"dependencies": { | ||
"@shapediver/viewer.rendering-engine.rendering-engine": "2.9.2", | ||
"@shapediver/viewer.rendering-engine.rendering-engine": "2.9.3", | ||
"@shapediver/viewer.settings": "0.4.2", | ||
"@shapediver/viewer.shared.math": "2.9.2", | ||
"@shapediver/viewer.shared.node-tree": "2.9.2", | ||
"@shapediver/viewer.shared.services": "2.9.2", | ||
"@shapediver/viewer.shared.types": "2.9.2", | ||
"@shapediver/viewer.shared.math": "2.9.3", | ||
"@shapediver/viewer.shared.node-tree": "2.9.3", | ||
"@shapediver/viewer.shared.services": "2.9.3", | ||
"@shapediver/viewer.shared.types": "2.9.3", | ||
"@tweenjs/tween.js": "^18.6.4", | ||
@@ -53,3 +53,3 @@ "detect-it": "4.0.1", | ||
}, | ||
"gitHead": "0d3496367603fcd4ac22df8c0bf8f4a3505dda01" | ||
"gitHead": "2b82f793e44032b1fccc9669f84f36c8ac905e2e" | ||
} |
@@ -41,4 +41,5 @@ import { | ||
constructor(id: string, version?: string) { | ||
constructor(id: string, version?: string, initialAspect?: number) { | ||
super(id, CAMERA_TYPE.PERSPECTIVE, version); | ||
this.#aspect = initialAspect; | ||
this._controls = new PerspectiveCameraControls(this, true); | ||
@@ -138,3 +139,3 @@ } | ||
public clone(): IPerspectiveCamera { | ||
return new PerspectiveCamera(this.id, this.version); | ||
return new PerspectiveCamera(this.id, this.version, this.aspect); | ||
} | ||
@@ -141,0 +142,0 @@ |
@@ -163,3 +163,4 @@ import { | ||
const camera = CAMERA_TYPE.PERSPECTIVE === type ? new PerspectiveCamera(cameraId) : new OrthographicCamera(cameraId); | ||
const initialAspectRatio = (<HTMLDivElement>this._renderingEngine.canvas.parentNode).clientWidth / (<HTMLDivElement>this._renderingEngine.canvas.parentNode).clientHeight; | ||
const camera = CAMERA_TYPE.PERSPECTIVE === type ? new PerspectiveCamera(cameraId, undefined, initialAspectRatio) : new OrthographicCamera(cameraId); | ||
camera.assignViewer(this._renderingEngine); | ||
@@ -166,0 +167,0 @@ |
@@ -48,3 +48,3 @@ import { CameraControlsLogic } from './CameraControlsLogic' | ||
let x1 = x, y1 = y; | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2) { | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2 && event.touches.length >= 2) { | ||
x1 = (event.touches[0].pageX - event.touches[1].pageX) / window.innerWidth * (window.innerWidth / window.innerHeight); | ||
@@ -141,3 +141,3 @@ y1 = (event.touches[0].pageY - event.touches[1].pageY) / window.innerHeight; | ||
let x1 = x, y1 = y; | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2) { | ||
if (window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2 && event.touches.length >= 2) { | ||
x1 = (event.touches[0].pageX - event.touches[1].pageX) / window.innerWidth * (window.innerWidth / window.innerHeight); | ||
@@ -222,2 +222,3 @@ y1 = (event.touches[0].pageY - event.touches[1].pageY) / window.innerHeight; | ||
} else { | ||
if(event.touches.length < 1) return { x: 0, y: 0 }; | ||
return { | ||
@@ -224,0 +225,0 @@ x: event.touches[0].pageX / window.innerWidth * aspect, |
@@ -58,3 +58,3 @@ import { CameraControlsLogic } from './CameraControlsLogic' | ||
let x1 = x, y1 = y; | ||
if(window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2) { | ||
if(window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2 && event.touches.length >= 2) { | ||
x1 = (event.touches[0].pageX - event.touches[1].pageX)/ window.innerWidth * (window.innerWidth / window.innerHeight); | ||
@@ -154,3 +154,3 @@ y1 = (event.touches[0].pageY - event.touches[1].pageY)/ window.innerHeight; | ||
let x1 = x, y1 = y; | ||
if(window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2) { | ||
if(window.TouchEvent && event instanceof TouchEvent && this._controls.input.touch.zoom === 2 && event.touches.length >= 2) { | ||
x1 = (event.touches[0].pageX - event.touches[1].pageX)/ window.innerWidth * (window.innerWidth / window.innerHeight); | ||
@@ -238,2 +238,3 @@ y1 = (event.touches[0].pageY - event.touches[1].pageY)/ window.innerHeight; | ||
} else { | ||
if(event.touches.length < 1) return { x: 0, y: 0 }; | ||
return { | ||
@@ -240,0 +241,0 @@ x: event.touches[0].pageX / window.innerWidth * aspect, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
549666
7359
+ Added@shapediver/sdk.geometry-api-sdk-core@1.3.2(transitive)
+ Added@shapediver/sdk.geometry-api-sdk-v2@1.5.1(transitive)
+ Added@shapediver/sdk.sdtf-core@1.4.2(transitive)
+ Added@shapediver/sdk.sdtf-geometry@1.4.2(transitive)
+ Added@shapediver/sdk.sdtf-primitives@1.4.2(transitive)
+ Added@shapediver/sdk.sdtf-v1@1.4.0(transitive)
+ Added@shapediver/viewer.rendering-engine.rendering-engine@2.9.3(transitive)
+ Added@shapediver/viewer.shared.build-data@2.9.3(transitive)
+ Added@shapediver/viewer.shared.math@2.9.3(transitive)
+ Added@shapediver/viewer.shared.node-tree@2.9.3(transitive)
+ Added@shapediver/viewer.shared.services@2.9.3(transitive)
+ Added@shapediver/viewer.shared.types@2.9.3(transitive)
+ Addedaxios@1.6.8(transitive)
- Removed@shapediver/sdk.geometry-api-sdk-core@1.2.6(transitive)
- Removed@shapediver/sdk.geometry-api-sdk-v2@1.4.0(transitive)
- Removed@shapediver/sdk.sdtf-core@1.3.1(transitive)
- Removed@shapediver/sdk.sdtf-geometry@1.3.1(transitive)
- Removed@shapediver/sdk.sdtf-primitives@1.3.1(transitive)
- Removed@shapediver/sdk.sdtf-v1@1.3.1(transitive)
- Removed@shapediver/viewer.rendering-engine.rendering-engine@2.9.2(transitive)
- Removed@shapediver/viewer.shared.build-data@2.9.2(transitive)
- Removed@shapediver/viewer.shared.math@2.9.2(transitive)
- Removed@shapediver/viewer.shared.node-tree@2.9.2(transitive)
- Removed@shapediver/viewer.shared.services@2.9.2(transitive)
- Removed@shapediver/viewer.shared.types@2.9.2(transitive)
Updated@shapediver/viewer.rendering-engine.rendering-engine@2.9.3