Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
viewModel.orbitTickFunction = undefined
viewModel.isOrbiting = true
viewModel.orbitLastTimestamp = getTimestamp()
var camera = scene.camera
if (defined(viewModel.terria.trackedEntity)) {
// when tracking an entity simply use that reference frame
viewModel.orbitFrame = undefined
viewModel.orbitIsLook = false
} else {
var center = Utils.getCameraFocus(viewModel.terria, true, centerScratch)
if (!defined(center)) {
viewModel.orbitFrame = Transforms.eastNorthUpToFixedFrame(camera.positionWC, scene.globe.ellipsoid, newTransformScratch)
viewModel.orbitIsLook = true
} else {
viewModel.orbitFrame = Transforms.eastNorthUpToFixedFrame(center, scene.globe.ellipsoid, newTransformScratch)
viewModel.orbitIsLook = false
}
}
viewModel.orbitTickFunction = function (e) {
var timestamp = getTimestamp()
var deltaT = timestamp - viewModel.orbitLastTimestamp
var rate = (viewModel.orbitCursorOpacity - 0.5) * 2.5 / 1000
var distance = deltaT * rate
var angle = viewModel.orbitCursorAngle + CesiumMath.PI_OVER_TWO
var x = Math.cos(angle) * distance
var y = Math.sin(angle) * distance
viewModel.isRotating = true
viewModel.rotateInitialCursorAngle = Math.atan2(-cursorVector.y, cursorVector.x)
if (defined(viewModel.terria.trackedEntity)) {
// when tracking an entity simply use that reference frame
viewModel.rotateFrame = undefined
viewModel.rotateIsLook = false
} else {
var viewCenter = Utils.getCameraFocus(viewModel.terria, true, centerScratch)
if (!defined(viewCenter) || (scene.mode === SceneMode.COLUMBUS_VIEW && !sscc.enableLook && !sscc.enableTranslate)) {
viewModel.rotateFrame = Transforms.eastNorthUpToFixedFrame(camera.positionWC, scene.globe.ellipsoid, newTransformScratch)
viewModel.rotateIsLook = true
} else {
viewModel.rotateFrame = Transforms.eastNorthUpToFixedFrame(viewCenter, scene.globe.ellipsoid, newTransformScratch)
viewModel.rotateIsLook = false
}
}
var oldTransform
if (defined(viewModel.rotateFrame)) {
oldTransform = Matrix4.clone(camera.transform, oldTransformScratch)
camera.lookAtTransform(viewModel.rotateFrame)
}
viewModel.rotateInitialCameraAngle = -camera.heading
if (defined(viewModel.rotateFrame)) {
camera.lookAtTransform(oldTransform)
}
viewModel.rotateMouseMoveFunction = undefined
viewModel.rotateMouseUpFunction = undefined
viewModel.isRotating = true
viewModel.rotateInitialCursorAngle = Math.atan2(-cursorVector.y, cursorVector.x)
if (defined(viewModel.terria.trackedEntity)) {
// when tracking an entity simply use that reference frame
viewModel.rotateFrame = undefined
viewModel.rotateIsLook = false
} else {
var viewCenter = Utils.getCameraFocus(viewModel.terria, true, centerScratch)
if (!defined(viewCenter) || (scene.mode === SceneMode.COLUMBUS_VIEW && !sscc.enableLook && !sscc.enableTranslate)) {
viewModel.rotateFrame = Transforms.eastNorthUpToFixedFrame(camera.positionWC, scene.globe.ellipsoid, newTransformScratch)
viewModel.rotateIsLook = true
} else {
viewModel.rotateFrame = Transforms.eastNorthUpToFixedFrame(viewCenter, scene.globe.ellipsoid, newTransformScratch)
viewModel.rotateIsLook = false
}
}
var oldTransform
if (defined(viewModel.rotateFrame)) {
oldTransform = Matrix4.clone(camera.transform, oldTransformScratch)
camera.lookAtTransform(viewModel.rotateFrame)
}
viewModel.rotateInitialCameraAngle = -camera.heading
if (defined(viewModel.rotateFrame)) {
viewModel.orbitLastTimestamp = getTimestamp()
var camera = scene.camera
if (defined(viewModel.terria.trackedEntity)) {
// when tracking an entity simply use that reference frame
viewModel.orbitFrame = undefined
viewModel.orbitIsLook = false
} else {
var center = Utils.getCameraFocus(viewModel.terria, true, centerScratch)
if (!defined(center)) {
viewModel.orbitFrame = Transforms.eastNorthUpToFixedFrame(camera.positionWC, scene.globe.ellipsoid, newTransformScratch)
viewModel.orbitIsLook = true
} else {
viewModel.orbitFrame = Transforms.eastNorthUpToFixedFrame(center, scene.globe.ellipsoid, newTransformScratch)
viewModel.orbitIsLook = false
}
}
viewModel.orbitTickFunction = function (e) {
var timestamp = getTimestamp()
var deltaT = timestamp - viewModel.orbitLastTimestamp
var rate = (viewModel.orbitCursorOpacity - 0.5) * 2.5 / 1000
var distance = deltaT * rate
var angle = viewModel.orbitCursorAngle + CesiumMath.PI_OVER_TWO
var x = Math.cos(angle) * distance
var y = Math.sin(angle) * distance
var oldTransform
.add("Basic", () => (
.add("Events", () => (
.add("Events", () => (