MCPcopy
hub / github.com/CesiumGS/cesium / translate2D

Function translate2D

packages/engine/Source/Scene/ScreenSpaceCameraController.js:989–1008  ·  view source on GitHub ↗
(controller, startPosition, movement)

Source from the content-addressed store, hash-verified

987const scratchTranslateP0 = new Cartesian3();
988
989function translate2D(controller, startPosition, movement) {
990 const scene = controller._scene;
991 const camera = scene.camera;
992 let start = camera.getPickRay(
993 movement.startPosition,
994 translate2DStart,
995 ).origin;
996 let end = camera.getPickRay(movement.endPosition, translate2DEnd).origin;
997
998 start = Cartesian3.fromElements(start.y, start.z, start.x, start);
999 end = Cartesian3.fromElements(end.y, end.z, end.x, end);
1000
1001 const direction = Cartesian3.subtract(start, end, scratchTranslateP0);
1002 const distance = Cartesian3.magnitude(direction);
1003
1004 if (distance > 0.0) {
1005 Cartesian3.normalize(direction, direction);
1006 camera.move(direction, distance);
1007 }
1008}
1009
1010function zoom2D(controller, startPosition, movement) {
1011 if (defined(movement.distance)) {

Callers

nothing calls this directly

Calls 4

fromElementsMethod · 0.45
subtractMethod · 0.45
magnitudeMethod · 0.45
normalizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…