Skip to content

Commit

Permalink
Remove needless 2nd arg in setPointOfView
Browse files Browse the repository at this point in the history
  • Loading branch information
vasturiano committed Dec 28, 2024
1 parent b8f8f7d commit 730b498
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions example/html-markers/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
tbControls.zoomSpeed = 0.8;

// Update pov when camera moves
Globe.setPointOfView(camera.position, Globe.position);
tbControls.addEventListener('change', () => Globe.setPointOfView(camera.position, Globe.position));
Globe.setPointOfView(camera.position);
tbControls.addEventListener('change', () => Globe.setPointOfView(camera.position));

// Kick-off renderers
(function animate() { // IIFE
Expand Down
6 changes: 4 additions & 2 deletions src/globe-kapsule.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,12 @@ export default Kapsule({
getGlobeRadius,
getCoords: (state, ...args) => polar2Cartesian(...args),
toGeoCoords: (state, ...args) => cartesian2Polar(...args),
setPointOfView: (state, globalPov, globePos) => {
setPointOfView: (state, globalPov) => {
let isBehindGlobe = undefined;
if (globalPov) {
if (state.scene && globalPov) {
const globeRadius = getGlobeRadius();
const globePos = new THREE.Vector3();
state.scene.getWorldPosition(globePos);
const pov = globePos ? globalPov.clone().sub(globePos) : globalPov; // convert to local vector

let povDist, povEdgeDist, povEdgeAngle, maxSurfacePosAngle;
Expand Down
2 changes: 1 addition & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export declare class ThreeGlobeGeneric<ChainableInstance> extends Object3D {
getGlobeRadius(): number;
getCoords(lat: number, lng: number, altitude?: number): { x: number, y: number, z: number };
toGeoCoords(coords: { x: number, y: number, z: number }): { lat: number, lng: number, altitude: number };
setPointOfView(pov: Vector3, globePos?: Vector3): void;
setPointOfView(pov: Vector3): void;

// Render options
rendererSize(): Vector2;
Expand Down

0 comments on commit 730b498

Please sign in to comment.