@@ -104,176 +104,176 @@ define([
104
104
* @type {Boolean }
105
105
* @default false
106
106
*/
107
- this . frustums = knockout . observable ( false ) ;
107
+ this . frustums = false ;
108
108
109
109
/**
110
110
* Gets or sets the show performance display state. This property is observable.
111
111
* @type {Boolean }
112
112
* @default false
113
113
*/
114
- this . performance = knockout . observable ( false ) ;
114
+ this . performance = false ;
115
115
116
116
/**
117
117
* Gets or sets the shader cache text. This property is observable.
118
118
* @type {String }
119
119
* @default ''
120
120
*/
121
- this . shaderCacheText = knockout . observable ( '' ) ;
121
+ this . shaderCacheText = '' ;
122
122
123
123
/**
124
124
* Gets or sets the show primitive bounding sphere state. This property is observable.
125
125
* @type {Boolean }
126
126
* @default false
127
127
*/
128
- this . primitiveBoundingSphere = knockout . observable ( false ) ;
128
+ this . primitiveBoundingSphere = false ;
129
129
130
130
/**
131
131
* Gets or sets the show primitive reference frame state. This property is observable.
132
132
* @type {Boolean }
133
133
* @default false
134
134
*/
135
- this . primitiveReferenceFrame = knockout . observable ( false ) ;
135
+ this . primitiveReferenceFrame = false ;
136
136
137
137
/**
138
138
* Gets or sets the filter primitive state. This property is observable.
139
139
* @type {Boolean }
140
140
* @default false
141
141
*/
142
- this . filterPrimitive = knockout . observable ( false ) ;
142
+ this . filterPrimitive = false ;
143
143
144
144
/**
145
145
* Gets or sets the show tile bounding sphere state. This property is observable.
146
146
* @type {Boolean }
147
147
* @default false
148
148
*/
149
- this . tileBoundingSphere = knockout . observable ( false ) ;
149
+ this . tileBoundingSphere = false ;
150
150
151
151
/**
152
152
* Gets or sets the filter tile state. This property is observable.
153
153
* @type {Boolean }
154
154
* @default false
155
155
*/
156
- this . filterTile = knockout . observable ( false ) ;
156
+ this . filterTile = false ;
157
157
158
158
/**
159
159
* Gets or sets the show wireframe state. This property is observable.
160
160
* @type {Boolean }
161
161
* @default false
162
162
*/
163
- this . wireframe = knockout . observable ( false ) ;
163
+ this . wireframe = false ;
164
164
165
165
/**
166
166
* Gets or sets the show globe depth state. This property is observable.
167
167
* @type {Boolean }
168
168
* @default false
169
169
*/
170
- this . globeDepth = knockout . observable ( false ) ;
170
+ this . globeDepth = false ;
171
171
172
172
/**
173
173
* Gets or sets the show pick depth state. This property is observable.
174
174
* @type {Boolean }
175
175
* @default false
176
176
*/
177
- this . pickDepth = knockout . observable ( false ) ;
177
+ this . pickDepth = false ;
178
178
179
179
/**
180
180
* Gets or sets the index of the depth frustum to display. This property is observable.
181
181
* @type {Number }
182
182
* @default 1
183
183
*/
184
- this . depthFrustum = knockout . observable ( 1 ) ;
184
+ this . depthFrustum = 1 ;
185
185
this . _numberOfFrustums = 1 ;
186
186
187
187
/**
188
188
* Gets or sets the suspend updates state. This property is observable.
189
189
* @type {Boolean }
190
190
* @default false
191
191
*/
192
- this . suspendUpdates = knockout . observable ( false ) ;
192
+ this . suspendUpdates = false ;
193
193
194
194
/**
195
195
* Gets or sets the show tile coordinates state. This property is observable.
196
196
* @type {Boolean }
197
197
* @default false
198
198
*/
199
- this . tileCoordinates = knockout . observable ( false ) ;
199
+ this . tileCoordinates = false ;
200
200
201
201
/**
202
202
* Gets or sets the frustum statistic text. This property is observable.
203
203
* @type {String }
204
204
* @default ''
205
205
*/
206
- this . frustumStatisticText = knockout . observable ( '' ) ;
206
+ this . frustumStatisticText = false ;
207
207
208
208
/**
209
209
* Gets or sets the selected tile information text. This property is observable.
210
210
* @type {String }
211
211
* @default ''
212
212
*/
213
- this . tileText = knockout . observable ( '' ) ;
213
+ this . tileText = '' ;
214
214
215
215
/**
216
216
* Gets if a primitive has been selected. This property is observable.
217
217
* @type {Boolean }
218
218
* @default false
219
219
*/
220
- this . hasPickedPrimitive = knockout . observable ( false ) ;
220
+ this . hasPickedPrimitive = false ;
221
221
222
222
/**
223
223
* Gets if a tile has been selected. This property is observable
224
224
* @type {Boolean }
225
225
* @default false
226
226
*/
227
- this . hasPickedTile = knockout . observable ( false ) ;
227
+ this . hasPickedTile = false ;
228
228
229
229
/**
230
230
* Gets if the picking primitive command is active. This property is observable.
231
231
* @type {Boolean }
232
232
* @default false
233
233
*/
234
- this . pickPrimitiveActive = knockout . observable ( false ) ;
234
+ this . pickPrimitiveActive = false ;
235
235
236
236
/**
237
237
* Gets if the picking tile command is active. This property is observable.
238
238
* @type {Boolean }
239
239
* @default false
240
240
*/
241
- this . pickTileActive = knockout . observable ( false ) ;
241
+ this . pickTileActive = false ;
242
242
243
243
/**
244
244
* Gets or sets if the cesium inspector drop down is visible. This property is observable.
245
245
* @type {Boolean }
246
246
* @default true
247
247
*/
248
- this . dropDownVisible = knockout . observable ( true ) ;
248
+ this . dropDownVisible = true ;
249
249
250
250
/**
251
251
* Gets or sets if the general section is visible. This property is observable.
252
252
* @type {Boolean }
253
253
* @default true
254
254
*/
255
- this . generalVisible = knockout . observable ( true ) ;
255
+ this . generalVisible = true ;
256
256
257
257
/**
258
258
* Gets or sets if the primitive section is visible. This property is observable.
259
259
* @type {Boolean }
260
260
* @default false
261
261
*/
262
- this . primitivesVisible = knockout . observable ( false ) ;
262
+ this . primitivesVisible = false ;
263
263
264
264
/**
265
265
* Gets or sets if the terrain section is visible. This property is observable.
266
266
* @type {Boolean }
267
267
* @default false
268
268
*/
269
- this . terrainVisible = knockout . observable ( false ) ;
269
+ this . terrainVisible = false ;
270
270
271
271
/**
272
272
* Gets or sets the index of the depth frustum text. This property is observable.
273
273
* @type {String }
274
- * @default '1 of 1 '
274
+ * @default ''
275
275
*/
276
- this . depthFrustumText = knockout . observable ( '1 of 1' ) ;
276
+ this . depthFrustumText = '' ;
277
277
278
278
/**
279
279
* Gets the text on the general section expand button. This property is computed.
@@ -302,6 +302,34 @@ define([
302
302
return that . terrainVisible ? '-' : '+' ;
303
303
} ) ;
304
304
305
+ knockout . track ( this , [
306
+ 'frustums' ,
307
+ 'performance' ,
308
+ 'shaderCacheText' ,
309
+ 'primitiveBoundingSphere' ,
310
+ 'primitiveReferenceFrame' ,
311
+ 'filterPrimitive' ,
312
+ 'tileBoundingSphere' ,
313
+ 'filterTile' ,
314
+ 'wireframe' ,
315
+ 'globeDepth' ,
316
+ 'pickDepth' ,
317
+ 'depthFrustum' ,
318
+ 'suspendUpdates' ,
319
+ 'tileCoordinates' ,
320
+ 'frustumStatisticText' ,
321
+ 'tileText' ,
322
+ 'hasPickedPrimitive' ,
323
+ 'hasPickedTile' ,
324
+ 'pickPrimitiveActive' ,
325
+ 'pickTileActive' ,
326
+ 'dropDownVisible' ,
327
+ 'generalVisible' ,
328
+ 'primitivesVisible' ,
329
+ 'terrainVisible' ,
330
+ 'depthFrustumText'
331
+ ] ) ;
332
+
305
333
this . _toggleDropDown = createCommand ( function ( ) {
306
334
that . dropDownVisible = ! that . dropDownVisible ;
307
335
} ) ;
@@ -318,11 +346,11 @@ define([
318
346
that . terrainVisible = ! that . terrainVisible ;
319
347
} ) ;
320
348
321
- this . frustums . subscribe ( function ( val ) {
349
+ this . _frustumsSubscription = knockout . getObservable ( this , ' frustums' ) . subscribe ( function ( val ) {
322
350
that . _scene . debugShowFrustums = val ;
323
351
} ) ;
324
352
325
- this . performance . subscribe ( function ( val ) {
353
+ this . _performanceSubscriptioin = knockout . getObservable ( this , ' performance' ) . subscribe ( function ( val ) {
326
354
if ( val ) {
327
355
that . _performanceDisplay = new PerformanceDisplay ( {
328
356
container : that . _performanceContainer
@@ -337,7 +365,7 @@ define([
337
365
return true ;
338
366
} ) ;
339
367
340
- this . primitiveBoundingSphere . subscribe ( function ( ) {
368
+ this . _primitiveBoundingSphereSubscription = knockout . getObservable ( this , ' primitiveBoundingSphere' ) . subscribe ( function ( ) {
341
369
that . _showPrimitiveBoundingSphere ( ) ;
342
370
} ) ;
343
371
@@ -355,7 +383,7 @@ define([
355
383
return true ;
356
384
} ) ;
357
385
358
- this . primitiveReferenceFrame . subscribe ( function ( ) {
386
+ this . _primitiveReferenceFrameSubscription = knockout . getObservable ( this , ' primitiveReferenceFrame' ) . subscribe ( function ( ) {
359
387
that . _showPrimitiveReferenceFrame ( ) ;
360
388
} ) ;
361
389
@@ -375,23 +403,23 @@ define([
375
403
return true ;
376
404
} ) ;
377
405
378
- this . filterPrimitive . subscribe ( function ( ) {
406
+ this . _filterPrimitiveSubscription = knockout . getObservable ( this , ' filterPrimitive' ) . subscribe ( function ( ) {
379
407
that . _doFilterPrimitive ( ) ;
380
408
} ) ;
381
409
382
- this . wireframe . subscribe ( function ( val ) {
410
+ this . _wireframeSubscription = knockout . getObservable ( this , ' wireframe' ) . subscribe ( function ( val ) {
383
411
globe . _surface . tileProvider . _debug . wireframe = val ;
384
412
} ) ;
385
413
386
- this . globeDepth . subscribe ( function ( val ) {
414
+ this . _globeDepthSubscription = knockout . getObservable ( this , ' globeDepth' ) . subscribe ( function ( val ) {
387
415
that . _scene . debugShowGlobeDepth = val ;
388
416
} ) ;
389
417
390
- this . pickDepth . subscribe ( function ( val ) {
418
+ this . _pickDepthSubscription = knockout . getObservable ( this , ' pickDepth' ) . subscribe ( function ( val ) {
391
419
that . _scene . debugShowPickDepth = val ;
392
420
} ) ;
393
421
394
- this . depthFrustum . subscribe ( function ( val ) {
422
+ this . _depthFrustumSubscription = knockout . getObservable ( this , ' depthFrustum' ) . subscribe ( function ( val ) {
395
423
that . scene . debugShowDepthFrustum = val ;
396
424
} ) ;
397
425
@@ -407,7 +435,7 @@ define([
407
435
return true ;
408
436
} ) ;
409
437
410
- this . suspendUpdates . subscribe ( function ( val ) {
438
+ this . _suspendUpdatesSubscription = knockout . getObservable ( this , ' suspendUpdates' ) . subscribe ( function ( val ) {
411
439
globe . _surface . _debug . suspendLodUpdate = val ;
412
440
if ( ! val ) {
413
441
that . filterTile = false ;
@@ -427,11 +455,11 @@ define([
427
455
return true ;
428
456
} ) ;
429
457
430
- this . tileCoordinates . subscribe ( function ( ) {
458
+ this . _tileCoordinatesSubscription = knockout . getObservable ( this , ' tileCoordinates' ) . subscribe ( function ( ) {
431
459
that . _showTileCoordinates ( ) ;
432
460
} ) ;
433
461
434
- this . tileBoundingSphere . subscribe ( function ( ) {
462
+ this . _tileBoundingSphereSubscription = knockout . getObservable ( this , ' tileBoundingSphere' ) . subscribe ( function ( ) {
435
463
that . _showTileBoundingSphere ( ) ;
436
464
} ) ;
437
465
@@ -444,7 +472,6 @@ define([
444
472
return true ;
445
473
} ) ;
446
474
447
-
448
475
this . _doFilterTile = createCommand ( function ( ) {
449
476
if ( ! that . filterTile ) {
450
477
that . suspendUpdates = false ;
@@ -460,7 +487,7 @@ define([
460
487
return true ;
461
488
} ) ;
462
489
463
- this . filterTile . subscribe ( function ( ) {
490
+ this . _filterTileSubscription = knockout . getObservable ( this , ' filterTile' ) . subscribe ( function ( ) {
464
491
that . doFilterTile ( ) ;
465
492
} ) ;
466
493
@@ -480,7 +507,7 @@ define([
480
507
that . pickPrimitiveActive = ! that . pickPrimitiveActive ;
481
508
} ) ;
482
509
483
- this . pickPrimitiveActive . subscribe ( function ( val ) {
510
+ this . _pickPrimitiveActiveSubscription = knockout . getObservable ( this , ' pickPrimitiveActive' ) . subscribe ( function ( val ) {
484
511
if ( val ) {
485
512
eventHandler . setInputAction ( pickPrimitive , ScreenSpaceEventType . LEFT_CLICK ) ;
486
513
} else {
@@ -523,15 +550,13 @@ define([
523
550
that . pickTileActive = ! that . pickTileActive ;
524
551
} ) ;
525
552
526
- this . pickTileActive . subscribe ( function ( val ) {
553
+ this . _pickTileActiveSubscription = knockout . getObservable ( this , ' pickTileActive' ) . subscribe ( function ( val ) {
527
554
if ( val ) {
528
555
eventHandler . setInputAction ( selectTile , ScreenSpaceEventType . LEFT_CLICK ) ;
529
556
} else {
530
557
eventHandler . removeInputAction ( ScreenSpaceEventType . LEFT_CLICK ) ;
531
558
}
532
559
} ) ;
533
-
534
- knockout . track ( this ) ;
535
560
}
536
561
537
562
defineProperties ( CesiumInspectorViewModel . prototype , {
@@ -913,6 +938,21 @@ define([
913
938
*/
914
939
CesiumInspectorViewModel . prototype . destroy = function ( ) {
915
940
this . _eventHandler . destroy ( ) ;
941
+ this . _frustumsSubscription . dispose ( ) ;
942
+ this . _performanceSubscriptioin . dispose ( ) ;
943
+ this . _primitiveBoundingSphereSubscription . dispose ( ) ;
944
+ this . _primitiveReferenceFrameSubscription . dispose ( ) ;
945
+ this . _filterPrimitiveSubscription . dispose ( ) ;
946
+ this . _wireframeSubscription . dispose ( ) ;
947
+ this . _globeDepthSubscription . dispose ( ) ;
948
+ this . _pickDepthSubscription . dispose ( ) ;
949
+ this . _depthFrustumSubscription . dispose ( ) ;
950
+ this . _suspendUpdatesSubscription . dispose ( ) ;
951
+ this . _tileCoordinatesSubscription . dispose ( ) ;
952
+ this . _tileBoundingSphereSubscription . dispose ( ) ;
953
+ this . _filterTileSubscription . dispose ( ) ;
954
+ this . _pickPrimitiveActiveSubscription . dispose ( ) ;
955
+ this . _pickTileActiveSubscription . dispose ( ) ;
916
956
return destroyObject ( this ) ;
917
957
} ;
918
958
0 commit comments