File tree Expand file tree Collapse file tree 2 files changed +28
-19
lines changed Expand file tree Collapse file tree 2 files changed +28
-19
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,7 @@ init_heart = function(){
347
347
}
348
348
349
349
function onClick ( event ) {
350
+ return
350
351
//event.preventDefault();
351
352
var mouse = new THREE . Vector2 ( ) ;
352
353
mouse . x = ( event . clientX / window . innerWidth ) * 2 - 1 ;
Original file line number Diff line number Diff line change @@ -96,26 +96,34 @@ THREE.ARMapzenGeography = function(opts){
96
96
var load_tile = function ( tx , ty , zoom , callback ) {
97
97
var key = tx + '_' + ty + '_' + zoom
98
98
MAP_CACHE [ key ] = 1 ;
99
- var cached_data = localStorage [ 'mz_' + key ] ;
100
- if ( cached_data ) {
101
- setTimeout ( function ( ) {
102
- callback ( JSON . parse ( cached_data ) ) ;
103
- } , 200 ) ;
104
- } else {
105
- var url = "https://tile.mapzen.com/mapzen/vector/v1/all/" + zoom + "/" + tx + "/" + ty + ".json?api_key=" + MAPZEN_API_KEY
106
- fetch ( url ) . then ( function ( response ) {
107
- return response . json ( ) ;
108
- } ) . then ( function ( data ) {
109
- callback ( data ) ;
110
- try {
111
- localStorage [ 'mz_' + key ] = JSON . stringify ( data ) ;
112
- } catch ( e ) {
113
- if ( e . toString ( ) . indexOf ( 'QuotaExceededError' ) > - 1 ) {
114
- localStorage . clear ( ) ;
115
- }
116
- }
117
- } ) ;
99
+ try {
100
+ var cached_data = localStorage [ 'mz_' + key ] ;
101
+ if ( cached_data ) {
102
+ cached_data = JSON . parse ( cached_data ) ;
103
+ setTimeout ( function ( ) {
104
+ callback ( JSON . parse ( cached_data ) ) ;
105
+ } , 200 ) ;
106
+ return
107
+ }
108
+
109
+ } catch ( e ) {
110
+
118
111
}
112
+
113
+ var url = "https://tile.mapzen.com/mapzen/vector/v1/all/" + zoom + "/" + tx + "/" + ty + ".json?api_key=" + MAPZEN_API_KEY
114
+ fetch ( url ) . then ( function ( response ) {
115
+ return response . json ( ) ;
116
+ } ) . then ( function ( data ) {
117
+ callback ( data ) ;
118
+ try {
119
+ localStorage [ 'mz_' + key ] = JSON . stringify ( data ) ;
120
+ } catch ( e ) {
121
+ if ( e . toString ( ) . indexOf ( 'QuotaExceededError' ) > - 1 ) {
122
+ localStorage . clear ( ) ;
123
+ }
124
+ }
125
+ } ) ;
126
+
119
127
} ;
120
128
121
129
You can’t perform that action at this time.
0 commit comments