File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
three.js/src/location-based/js Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ class LocationBased {
66 this . scene = scene ;
77 this . camera = camera ;
88 this . proj = new SphMercProjection ( ) ;
9+ this . eventHandlers = { } ;
910 }
1011
1112 setProjection ( proj ) {
@@ -20,6 +21,9 @@ class LocationBased {
2021 position . coords . longitude ,
2122 position . coords . latitude
2223 ) ;
24+ if ( this . eventHandlers [ "gpsupdate" ] ) {
25+ this . eventHandlers [ "gpsupdate" ] ( position ) ;
26+ }
2327 } , error => {
2428 alert ( `GPS listen error: code ${ error } ` ) ;
2529 } , {
@@ -61,6 +65,10 @@ class LocationBased {
6165 setElevation ( elev ) {
6266 this . camera . position . y = elev ;
6367 }
68+
69+ on ( eventName , eventHandler ) {
70+ this . eventHandlers [ eventName ] = eventHandler ;
71+ }
6472}
6573
6674export { LocationBased } ;
You can’t perform that action at this time.
0 commit comments