Implement Interactive Globe on Homepage
This commit is contained in:
@@ -24,7 +24,6 @@ const degToRad = deg => deg * Math.PI / 180
|
||||
|
||||
|
||||
class WebglGlobe {
|
||||
|
||||
// Constructor
|
||||
constructor (options) {
|
||||
this.$el = options.el // The DOM reference node
|
||||
@@ -34,7 +33,7 @@ class WebglGlobe {
|
||||
this.options.cameraDistance = 1 // this.options.cameraDistance || 1 // A multiplier to move camera backward or forward
|
||||
this.options.opacity = this.options.opacity || 1
|
||||
|
||||
this.cities = options.markers // List of cities with their options
|
||||
this.locations = options.markers // List of locations with their options
|
||||
this._canUpdate = false
|
||||
this.hasUpdateCameraPos = false
|
||||
this.referenceHeight = 1 // Used to set camera distance from globe where referenceHeight == window height
|
||||
@@ -157,7 +156,7 @@ class WebglGlobe {
|
||||
* Create DOM nodes for markers and 3D positions
|
||||
*/
|
||||
this.markers = []
|
||||
let markers = this.cities
|
||||
let markers = this.locations
|
||||
|
||||
// Instance all markers
|
||||
for (let i = 0; i < markers.length; i++) {
|
||||
@@ -362,7 +361,7 @@ class WebglGlobe {
|
||||
vec2.set(dir, x, y)
|
||||
let center = vec2.create()
|
||||
vec2.set(center, this.width/2, this.height/2)
|
||||
let dir2d = vec2.clone(dir, dir)
|
||||
let dir2d = vec2.clone(dir) // vec2.clone(dir, dir)
|
||||
vec2.subtract(dir2d, dir2d, center)
|
||||
vec2.normalize(dir2d, dir2d)
|
||||
vec2.scale(dir2d, dir2d, this.circleScreenSize)
|
||||
|
||||
Reference in New Issue
Block a user