@@ -19,12 +19,13 @@ import {REPLACE_IMAGES, DEFAULT_FITS_VIEWER_ID, getViewerPlotIds, getMultiViewRo
19
19
* These main components are image plots, charts, tables, dropdown panel, etc.
20
20
* This manager implements the default firefly viewer's requirements.
21
21
* Because it may differs between applications, it is okay to have a custom layout manager if needed.
22
- * @param [title] title to display.
23
- * @param views defaults to tri-view if not given.
24
- * @param callback
22
+ * @param { object } p
23
+ * @param [p.title] title to display. p
24
+ * @param p.views defaults to tri-view if not given.
25
25
*/
26
26
export function * layoutManager ( { title, views= 'tables | images | xyPlots' } ) {
27
27
views = LO_VIEW . get ( views ) || LO_VIEW . none ;
28
+ var coverageLockedOn = false ;
28
29
29
30
while ( true ) {
30
31
const action = yield take ( [
@@ -58,7 +59,7 @@ export function* layoutManager({title, views='tables | images | xyPlots'}) {
58
59
break ;
59
60
60
61
case TABLE_LOADED :
61
- [ showImages , images ] = handleNewTable ( action , images , showImages , showTables ) ;
62
+ [ showImages , images , coverageLockedOn ] = handleNewTable ( action , images , showImages , showTables , coverageLockedOn ) ;
62
63
break ;
63
64
64
65
case REPLACE_IMAGES :
@@ -67,10 +68,10 @@ export function* layoutManager({title, views='tables | images | xyPlots'}) {
67
68
[ showImages , images , ignore ] = handleNewImage ( action , images ) ;
68
69
break ;
69
70
case TBL_RESULTS_ACTIVE :
70
- [ showImages , images ] = handleActiveTableChange ( action . payload . tbl_id , images ) ;
71
+ [ showImages , images , coverageLockedOn ] = handleActiveTableChange ( action . payload . tbl_id , images , coverageLockedOn ) ;
71
72
break ;
72
73
case TABLE_REMOVE :
73
- [ showImages , images ] = handleActiveTableChange ( getActiveTableId ( findGroupByTblId ( action . payload . tbl_id ) ) , images ) ;
74
+ [ showImages , images , coverageLockedOn ] = handleActiveTableChange ( getActiveTableId ( findGroupByTblId ( action . payload . tbl_id ) ) , images , coverageLockedOn ) ;
74
75
break ;
75
76
76
77
}
@@ -133,53 +134,63 @@ function handleLayoutChanges(action) {
133
134
}
134
135
}
135
136
136
- function handleNewTable ( action , images , showImages , showTables ) {
137
+ function handleNewTable ( action , images , showImages , showTables , coverageLockedOn ) {
137
138
// check for catalog or meta images
138
- if ( ! showTables ) return [ showImages , images ] ; // ignores this if table is not visible
139
+ if ( ! showTables ) return [ showImages , images , coverageLockedOn ] ; // ignores this if table is not visible
139
140
const { tbl_id} = action . payload ;
140
141
const isMeta = isMetaDataTable ( tbl_id ) ;
141
142
if ( isMeta || isCatalogTable ( tbl_id ) ) {
142
143
if ( ! get ( images , 'showFits' ) ) {
143
- images = clone ( images , { selectedTab : 'coverage' , showCoverage : true } ) ;
144
+ // only show coverage if there are not images or coverage is showing
145
+ const showFits = shouldShowFits ( ) ;
146
+ coverageLockedOn = ! showFits || coverageLockedOn ;
147
+ images = clone ( images , { selectedTab : 'coverage' , showCoverage : coverageLockedOn } ) ;
144
148
showImages = true ;
145
149
}
146
150
}
147
151
if ( isMeta ) {
148
152
images = clone ( images , { selectedTab : 'meta' , showMeta : true , metaDataTableId : tbl_id } ) ;
149
153
showImages = true ;
150
154
}
151
- return [ showImages , images ] ;
155
+ return [ showImages , images , coverageLockedOn ] ;
152
156
}
153
157
154
- function handleActiveTableChange ( tbl_id , images ) {
158
+ function handleActiveTableChange ( tbl_id , images , coverageLockedOn ) {
155
159
// check for catalog or meta images
156
160
157
161
const showFits = shouldShowFits ( ) ;
158
- var showImages = showFits ;
162
+
163
+ var showImages = showFits || coverageLockedOn ;
159
164
160
165
if ( ! tbl_id ) {
161
166
images = clone ( images , { showMeta : false , showCoverage : false , showFits, metaDataTableId : null } ) ;
162
- return [ showFits , images ] ;
167
+ return [ showFits , images , false ] ;
163
168
}
164
169
165
170
const tblGroup = findGroupByTblId ( tbl_id ) ;
166
- if ( ! tblGroup ) return [ showImages , images ] ;
171
+ if ( ! tblGroup ) return [ showImages , images , coverageLockedOn ] ;
167
172
const tblList = getTblIdsByGroup ( tblGroup ) ;
168
- if ( isEmpty ( tblList ) ) return [ showImages , images ] ;
173
+ if ( isEmpty ( tblList ) ) return [ showImages , images , coverageLockedOn ] ;
169
174
170
175
const anyHasCatalog = hasCatalogTable ( tblList ) ;
171
176
const anyHasMeta = hasMetaTable ( tblList ) ;
172
177
178
+ if ( coverageLockedOn ) {
179
+ coverageLockedOn = anyHasCatalog || anyHasMeta ;
180
+ showImages = showFits || coverageLockedOn ;
181
+ }
173
182
174
183
if ( ! anyHasCatalog && ! anyHasMeta ) {
184
+ coverageLockedOn = false ;
185
+ showImages = showFits || coverageLockedOn ;
175
186
images = clone ( images , { showMeta : false , showCoverage : false , showFits, metaDataTableId : null } ) ;
176
- return [ showFits , images ] ;
187
+ return [ showFits , images , coverageLockedOn ] ;
177
188
}
178
189
179
190
180
191
181
192
if ( hasCatalogTable ( tblList ) ) {
182
- images = clone ( images , { showCoverage : true , showFits} ) ;
193
+ images = clone ( images , { showCoverage : coverageLockedOn , showFits} ) ;
183
194
showImages = true ;
184
195
}
185
196
@@ -191,7 +202,7 @@ function handleActiveTableChange (tbl_id, images) {
191
202
else {
192
203
images = clone ( images , { showMeta : false , showFits, metaTableId :null } ) ;
193
204
}
194
- return [ showImages , images ] ;
205
+ return [ showImages , images , coverageLockedOn ] ;
195
206
}
196
207
197
208
const hasCatalogTable = ( tblList ) => tblList . some ( ( id ) => isCatalogTable ( id ) ) ;
@@ -212,7 +223,7 @@ function handleNewImage(action, images) {
212
223
images = clone ( images , { selectedTab : 'fits' , showFits : true } ) ;
213
224
} else {
214
225
ignore = true ;
215
- } ;
226
+ }
216
227
217
228
return [ true , images , ignore ] ;
218
229
}
0 commit comments