Skip to content

Commit ca93085

Browse files
Fix/resampling null (#63)
* resampling should be omitted if not selected, otherwise include selected values
1 parent ab9f4c5 commit ca93085

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

__tests__/playwright/COGViewerDrawer.test.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ test.describe('COG Viewer Drawer', () => {
9898
rescale: [[-1, 1]],
9999
colormap_name: 'rdbu',
100100
color_formula: 'test123',
101+
resampling: 'nearest',
101102
nodata: 255,
102103
assets: ['cog_default'],
103104
},
@@ -295,6 +296,7 @@ test.describe('COG Viewer Drawer', () => {
295296
rescale: [[-1, 1]],
296297
colormap_name: 'rdbu',
297298
color_formula: 'test456',
299+
resampling: 'nearest',
298300
assets: ['cog_default'],
299301
},
300302
null,
@@ -323,6 +325,7 @@ test.describe('COG Viewer Drawer', () => {
323325
rescale: [[-1, 1]],
324326
colormap_name: 'rdbu',
325327
color_formula: 'test456',
328+
resampling: 'nearest',
326329
assets: ['cog_default'],
327330
},
328331
null,

components/COGControlsForm.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ const COGControlsForm: React.FC<COGControlsFormProps> = ({
210210
<Form.Item label="Resampling" name="selectedResampling">
211211
<Select
212212
showSearch
213+
allowClear
213214
data-testid="resampling"
214215
onChange={onResamplingChange}
215216
>

components/COGDrawerViewer.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,9 @@ const COGDrawerViewer: React.FC<COGDrawerViewerProps> = ({
6060
? cogViewer.selectedColormap
6161
: undefined,
6262
color_formula: cogViewer.colorFormula || undefined,
63-
resampling:
64-
cogViewer.selectedResampling !== 'nearest'
65-
? cogViewer.selectedResampling
66-
: undefined,
63+
...(cogViewer.selectedResampling != null && {
64+
resampling: cogViewer.selectedResampling,
65+
}),
6766
nodata: cogViewer.noDataValue || undefined,
6867
assets: ['cog_default'], // Ensure assets are included
6968
};

components/COGViewerContent.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ const COGViewerContent: React.FC<COGViewerContentProps> = ({
178178
rescale,
179179
colormap_name: selectedColormap.toLowerCase(),
180180
color_formula: colorFormula || undefined,
181-
resampling:
182-
selectedResampling !== 'nearest' ? selectedResampling : undefined,
181+
resampling: selectedResampling,
183182
nodata: noDataValue || undefined,
184183
}}
185184
/>

0 commit comments

Comments
 (0)