Skip to content

Commit

Permalink
revert commit 9ac13b0
Browse files Browse the repository at this point in the history
  • Loading branch information
TienHao committed May 15, 2024
1 parent 0d5f099 commit 6a8977c
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ export class FileBrowserDialogComponent extends React.Component {
let filterName: string;
let filterDescription: string;

switch (preferenceStore.silent.fileFilteringType) {
switch (preferenceStore.fileFilteringType) {
case FileFilteringType.Fuzzy:
filterName = "Fuzzy search";
filterDescription = "Filter by filename with fuzzy search";
Expand Down Expand Up @@ -701,8 +701,8 @@ export class FileBrowserDialogComponent extends React.Component {
selectedFile={fileBrowserStore.selectedFile}
selectedHDU={fileBrowserStore.selectedHDU}
filterString={this.debouncedFilterString}
filterType={appStore.preferenceStore.silent.fileFilteringType}
sortingString={appStore.preferenceStore.silent.fileSortingString}
filterType={appStore.preferenceStore.fileFilteringType}
sortingString={appStore.preferenceStore.fileSortingString}
onSortingChanged={fileBrowserStore.setSortingConfig}
onFileClicked={this.handleFileClicked}
onSelectionChanged={fileBrowserStore.setSelectedFiles}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,38 +211,34 @@ export class ImageViewSettingsPanelComponent extends React.Component<WidgetProps
const globalPanel = (
<div className="panel-container">
<FormGroup inline={true} label="Enable multi-panel">
<Switch checked={preferences.silent.imageMultiPanelEnabled} onChange={ev => appStore.widgetsStore.setImageMultiPanelEnabled(ev.currentTarget.checked)} />
<Switch checked={preferences.imageMultiPanelEnabled} onChange={ev => appStore.widgetsStore.setImageMultiPanelEnabled(ev.currentTarget.checked)} />
</FormGroup>
<FormGroup inline={true} label="Multi-panel mode" disabled={!preferences.silent.imageMultiPanelEnabled}>
<HTMLSelect
value={preferences.silent.imagePanelMode}
disabled={!preferences.silent.imageMultiPanelEnabled}
onChange={event => preferences.setPreference(PreferenceKeys.SILENT_IMAGE_PANEL_MODE, event.currentTarget.value as ImagePanelMode)}
>
<FormGroup inline={true} label="Multi-panel mode" disabled={!preferences.imageMultiPanelEnabled}>
<HTMLSelect value={preferences.imagePanelMode} disabled={!preferences.imageMultiPanelEnabled} onChange={event => preferences.setPreference(PreferenceKeys.IMAGE_PANEL_MODE, event.currentTarget.value as ImagePanelMode)}>
<option value={ImagePanelMode.Dynamic}>Dynamic grid size</option>
<option value={ImagePanelMode.Fixed}>Fixed grid size</option>
</HTMLSelect>
</FormGroup>
<FormGroup inline={true} label="Columns" labelInfo={preferences.silent.imagePanelMode === ImagePanelMode.Dynamic ? "(Maximum)" : "(Fixed)"} disabled={!preferences.silent.imageMultiPanelEnabled}>
<FormGroup inline={true} label="Columns" labelInfo={preferences.imagePanelMode === ImagePanelMode.Dynamic ? "(Maximum)" : "(Fixed)"} disabled={!preferences.imageMultiPanelEnabled}>
<SafeNumericInput
placeholder="Columns"
min={1}
value={preferences.silent.imagePanelColumns}
disabled={!preferences.silent.imageMultiPanelEnabled}
value={preferences.imagePanelColumns}
disabled={!preferences.imageMultiPanelEnabled}
stepSize={1}
minorStepSize={null}
onValueChange={value => preferences.setPreference(PreferenceKeys.SILENT_IMAGE_PANEL_COLUMNS, value)}
onValueChange={value => preferences.setPreference(PreferenceKeys.IMAGE_PANEL_COLUMNS, value)}
/>
</FormGroup>
<FormGroup inline={true} label="Rows" labelInfo={preferences.silent.imagePanelMode === ImagePanelMode.Dynamic ? "(Maximum)" : "(Fixed)"} disabled={!preferences.silent.imageMultiPanelEnabled}>
<FormGroup inline={true} label="Rows" labelInfo={preferences.imagePanelMode === ImagePanelMode.Dynamic ? "(Maximum)" : "(Fixed)"} disabled={!preferences.imageMultiPanelEnabled}>
<SafeNumericInput
placeholder="Rows"
min={1}
disabled={!preferences.silent.imageMultiPanelEnabled}
value={preferences.silent.imagePanelRows}
disabled={!preferences.imageMultiPanelEnabled}
value={preferences.imagePanelRows}
stepSize={1}
minorStepSize={null}
onValueChange={value => preferences.setPreference(PreferenceKeys.SILENT_IMAGE_PANEL_ROWS, value)}
onValueChange={value => preferences.setPreference(PreferenceKeys.IMAGE_PANEL_ROWS, value)}
/>
</FormGroup>
<FormGroup inline={true} label="Overlay color">
Expand Down Expand Up @@ -371,10 +367,10 @@ export class ImageViewSettingsPanelComponent extends React.Component<WidgetProps
</FormGroup>
</Collapse>
<FormGroup inline={true} label="Pixel grid">
<Switch checked={preferences.silent.pixelGridVisible} onChange={ev => preferences.setPreference(PreferenceKeys.SILENT_PIXEL_GRID_VISIBLE, ev.currentTarget.checked)} />
<Switch checked={preferences.pixelGridVisible} onChange={ev => preferences.setPreference(PreferenceKeys.PIXEL_GRID_VISIBLE, ev.currentTarget.checked)} />
</FormGroup>
<FormGroup inline={true} label="Pixel grid color">
<AutoColorPickerComponent color={preferences.silent.pixelGridColor} presetColors={SWATCH_COLORS} setColor={color => preferences.setPreference(PreferenceKeys.SILENT_PIXEL_GRID_COLOR, color)} disableAlpha={true} />
<AutoColorPickerComponent color={preferences.pixelGridColor} presetColors={SWATCH_COLORS} setColor={color => preferences.setPreference(PreferenceKeys.PIXEL_GRID_COLOR, color)} disableAlpha={true} />
</FormGroup>
</div>
);
Expand Down
8 changes: 4 additions & 4 deletions src/components/ImageView/RasterView/RasterViewComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class RasterViewComponent extends React.Component<RasterViewComponentProp
this.gl.uniform4f(shaderUniforms.NaNColor, rgba.r / 255, rgba.g / 255, rgba.b / 255, rgba.a);
}

const pixelGridColor = tinycolor(getColorForTheme(appStore.preferenceStore.silent.pixelGridColor));
const pixelGridColor = tinycolor(getColorForTheme(appStore.preferenceStore.pixelGridColor));
if (pixelGridColor.isValid()) {
const rgba = pixelGridColor.toRgb();
this.gl.uniform4f(shaderUniforms.PixelGridColor, rgba.r / 255, rgba.g / 255, rgba.b / 255, rgba.a);
Expand Down Expand Up @@ -352,7 +352,7 @@ export class RasterViewComponent extends React.Component<RasterViewComponentProp
const pixelGridZoomLow = 6.0;
const pixelGridZoomHigh = 12.0;

if (zoom >= pixelGridZoomLow && mip === 1 && appStore.preferenceStore.silent.pixelGridVisible) {
if (zoom >= pixelGridZoomLow && mip === 1 && appStore.preferenceStore.pixelGridVisible) {
const cutoff = 0.5 / zoom;
const opacity = 0.25 * smoothStep(zoom, pixelGridZoomLow, pixelGridZoomHigh);
this.gl.uniform1f(shaderUniforms.PixelGridCutoff, cutoff);
Expand Down Expand Up @@ -399,8 +399,8 @@ export class RasterViewComponent extends React.Component<RasterViewComponentProp
visibility: frame.renderConfig.visible,
nanColorHex: appStore.preferenceStore.nanColorHex,
nanAlpha: appStore.preferenceStore.nanAlpha,
pixelGridVisible: appStore.preferenceStore.silent.pixelGridVisible,
pixelGridColor: getColorForTheme(appStore.preferenceStore.silent.pixelGridColor)
pixelGridVisible: appStore.preferenceStore.pixelGridVisible,
pixelGridColor: getColorForTheme(appStore.preferenceStore.pixelGridColor)
};

const ratio = appStore.imageRatio;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Menu/RootMenuComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ export class RootMenuComponent extends React.Component {
private newReleaseButtonOnClick = () => {
const appStore = AppStore.Instance;
if (this.disableCheckRelease) {
appStore.preferenceStore.setPreference(PreferenceKeys.SILENT_CHECK_NEW_RELEASE, false);
appStore.preferenceStore.setPreference(PreferenceKeys.CHECK_NEW_RELEASE, false);
}
appStore.preferenceStore.setPreference(PreferenceKeys.SILENT_LATEST_RELEASE, appStore.newRelease);
appStore.preferenceStore.setPreference(PreferenceKeys.LATEST_RELEASE, appStore.newRelease);
appStore.setShowNewRelease(false);
};

Expand Down
18 changes: 9 additions & 9 deletions src/stores/AppStore/AppStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ export class AppStore {
this.setCursorFrozen(this.preferenceStore.isCursorFrozen);
this.updateASTColors();
this.setSpectralMatchingType(this.preferenceStore.spectralMatchingType);
if (this.preferenceStore.silent.checkNewRelease) {
if (this.preferenceStore.checkNewRelease) {
await this.checkNewRelease();
}
} catch (err) {
Expand All @@ -1678,7 +1678,7 @@ export class AppStore {
const response = await axios("https://api.github.com/repos/CARTAvis/carta/releases", {headers: {Accept: "application/vnd.github+json"}});
const latestRelease = response?.data?.[0]?.tag_name;

if (latestRelease && Semver.gt(latestRelease, this.preferenceStore.silent.latestRelease)) {
if (latestRelease && Semver.gt(latestRelease, this.preferenceStore.latestRelease)) {
console.log("new release available: ", latestRelease);
this.updateNewRelease(latestRelease);
}
Expand Down Expand Up @@ -1948,7 +1948,7 @@ export class AppStore {
});

autorun(() => {
this.activateStatsPanel(this.preferenceStore.silent.statsPanelEnabled);
this.activateStatsPanel(this.preferenceStore.statsPanelEnabled);
});
}

Expand Down Expand Up @@ -2946,10 +2946,10 @@ export class AppStore {
case ImagePanelMode.None:
return 1;
case ImagePanelMode.Fixed:
return Math.max(1, this.preferenceStore.silent.imagePanelColumns);
return Math.max(1, this.preferenceStore.imagePanelColumns);
default:
const numImages = this.frames?.length ?? 0;
return clamp(numImages, 1, this.preferenceStore.silent.imagePanelColumns);
return clamp(numImages, 1, this.preferenceStore.imagePanelColumns);
}
}

Expand All @@ -2958,10 +2958,10 @@ export class AppStore {
case ImagePanelMode.None:
return 1;
case ImagePanelMode.Fixed:
return Math.max(1, this.preferenceStore.silent.imagePanelRows);
return Math.max(1, this.preferenceStore.imagePanelRows);
default:
const numImages = this.frames?.length ?? 0;
return clamp(Math.ceil(numImages / this.preferenceStore.silent.imagePanelColumns), 1, this.preferenceStore.silent.imagePanelRows);
return clamp(Math.ceil(numImages / this.preferenceStore.imagePanelColumns), 1, this.preferenceStore.imagePanelRows);
}
}

Expand All @@ -2971,7 +2971,7 @@ export class AppStore {

@computed get imagePanelMode() {
const preferenceStore = PreferenceStore.Instance;
return preferenceStore.silent.imageMultiPanelEnabled ? preferenceStore.silent.imagePanelMode : ImagePanelMode.None;
return preferenceStore.imageMultiPanelEnabled ? preferenceStore.imagePanelMode : ImagePanelMode.None;
}

exportImage = (imageRatio: number) => {
Expand Down Expand Up @@ -3176,7 +3176,7 @@ export class AppStore {
import("stats-js")
.then(({default: Stats}) => {
const stats = new Stats();
stats.showPanel(this.preferenceStore.silent.statsPanelMode); // 0: fps, 1: ms, 2: mb, 3+: custom
stats.showPanel(this.preferenceStore.statsPanelMode); // 0: fps, 1: ms, 2: mb, 3+: custom
document.body.appendChild(stats.dom);

function animate() {
Expand Down

0 comments on commit 6a8977c

Please sign in to comment.