in src/globemap.ts [1040:1092]
private renderMagic(): void {
if (!this.data) {
return;
}
this.data.dataPoints.forEach(d => this.geocodeRenderDatum(d)); // all coordinates (latitude/longitude) will be gained here
this.data.dataPoints.forEach((d) => {
return d.location = this.globeMapLocationCache[d.placeKey] || d.location;
});
if (!this.readyToRender) {
this.defferedRender();
return;
}
this.updateBarsAndHeatMapByZoom();
if (this.barsGroup.children.length > 0 && this.camera && (this.initialLocationsLength !== this.barsGroup.children.length || this.barsGroup.children.length === 1)) {
this.averageBarVector.multiplyScalar(1 / this.barsGroup.children.length);
if (this.locationsLoaded === this.locationsToLoad) {
this.initialLocationsLength = this.barsGroup.children.length;
const maxDistance: number = this.GlobeSettings.cameraRadius - this.GlobeSettings.earthRadius;
const distance: number = (this.camera.position.length() - this.GlobeSettings.earthRadius) / maxDistance;
let angleRate: number = 12;
if (distance < 0.5) {
angleRate = 36;
} else if (distance < 0.25) {
angleRate = 60;
} else if (distance < 0.15) {
angleRate = 0;
}
if (angleRate > 0) {
const axisY = new THREE.Vector3(0, 1, 0);
const axisZ = new THREE.Vector3(0, 0, 1);
const angle = Math.PI / angleRate;
this.averageBarVector.applyAxisAngle(axisY, angle);
this.averageBarVector.applyAxisAngle(axisZ, angle);
}
this.isFirstLoad ? this.setCameraPosition(this.averageBarVector) : this.animateCamera(this.averageBarVector);
}
}
this.heatmap.blur();
this.heatTexture.needsUpdate = true;
this.needsRender = true;
if (this.isFirstLoad === true) {
this.isFirstLoad = false;
}
}