fix globe height
This commit is contained in:
@@ -31,7 +31,8 @@ class WebglGlobe {
|
|||||||
this.options = options
|
this.options = options
|
||||||
this.options.autoRotationSpeed = this.options.autoRotationSpeed || 0
|
this.options.autoRotationSpeed = this.options.autoRotationSpeed || 0
|
||||||
this.options.scrollSmoothing = this.options.scrollSmoothing || 0.5 // Smooth the globe position to avoid janks on scroll (lower == smoother)
|
this.options.scrollSmoothing = this.options.scrollSmoothing || 0.5 // Smooth the globe position to avoid janks on scroll (lower == smoother)
|
||||||
this.options.cameraDistance = this.options.cameraDistance || 1 // A multiplier to move camera backward or forward
|
this.options.cameraDistance = 1//this.options.cameraDistance || 1 // A multiplier to move camera backward or forward
|
||||||
|
|
||||||
this.cities = options.markers // List of cities with their options
|
this.cities = options.markers // List of cities with their options
|
||||||
this._canUpdate = false
|
this._canUpdate = false
|
||||||
this.hasUpdateCameraPos = false
|
this.hasUpdateCameraPos = false
|
||||||
@@ -233,6 +234,9 @@ class WebglGlobe {
|
|||||||
this.width = window ? window.innerWidth : 0
|
this.width = window ? window.innerWidth : 0
|
||||||
this.height = window ? window.innerHeight : 0
|
this.height = window ? window.innerHeight : 0
|
||||||
|
|
||||||
|
//fit globe to container height
|
||||||
|
this.options.cameraDistance = this.height / this.$el.clientHeight;
|
||||||
|
|
||||||
// Remove retina on small screen (aka mobile) to boost perfs
|
// Remove retina on small screen (aka mobile) to boost perfs
|
||||||
this.renderer.setPixelRatio( window.innerWidth < 768 ? 1 : window.devicePixelRatio)
|
this.renderer.setPixelRatio( window.innerWidth < 768 ? 1 : window.devicePixelRatio)
|
||||||
this.renderer.resize(this.width , this.height)
|
this.renderer.resize(this.width , this.height)
|
||||||
@@ -283,10 +287,14 @@ class WebglGlobe {
|
|||||||
* This helps saving perfs and battery
|
* This helps saving perfs and battery
|
||||||
*/
|
*/
|
||||||
enable () {
|
enable () {
|
||||||
|
this.renderer.canvas.style.opacity = 1
|
||||||
|
this.$markerWrapper.style.opacity = 1
|
||||||
this._canUpdate = true
|
this._canUpdate = true
|
||||||
}
|
}
|
||||||
|
|
||||||
disable () {
|
disable () {
|
||||||
|
this.renderer.canvas.style.opacity = 0
|
||||||
|
this.$markerWrapper.style.opacity = 0
|
||||||
this._canUpdate = false
|
this._canUpdate = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
// }
|
// }
|
||||||
// END DEBUG //
|
// END DEBUG //
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Partial globe
|
** Partial globe
|
||||||
*/
|
*/
|
||||||
@@ -44,8 +43,6 @@
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Markers
|
** Markers
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user