Skip to content

Commit d34f65c

Browse files
committed
fix: remove zoom due to UI issues
closes #78
1 parent 812bdc8 commit d34f65c

File tree

7 files changed

+1
-42
lines changed

7 files changed

+1
-42
lines changed

src/components/App/index.tsx

-15
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ import { ActionIcon, Box, Global, Group, Image, MantineProvider, Paper, Text, Tr
33
import surrealistIcon from '~/assets/icon.png';
44
import { NotificationsProvider } from "@mantine/notifications";
55
import { Scaffold } from "../Scaffold";
6-
import { useHotkeys } from "@mantine/hooks";
76
import { actions, store, useStoreValue } from "~/store";
87
import { useSurrealistTheme } from "~/util/theme";
98
import { mdiClose } from "@mdi/js";
109
import { Icon } from "../Icon";
1110
import { useStable } from "~/hooks/stable";
1211
import { MouseEvent } from "react";
13-
import { updateConfig, updateZoom } from "~/util/helpers";
1412
import { open } from "@tauri-apps/api/shell";
1513

1614
export function App() {
@@ -32,19 +30,6 @@ export function App() {
3230
closeUpdate();
3331
});
3432

35-
useHotkeys([
36-
['ctrl+equal', () => {
37-
store.dispatch(actions.increaseZoomLevel());
38-
updateConfig();
39-
updateZoom();
40-
}],
41-
['ctrl+minus', () => {
42-
store.dispatch(actions.decreaseZoomLevel());
43-
updateConfig();
44-
updateZoom();
45-
}]
46-
], []);
47-
4833
return (
4934
<MantineProvider
5035
withGlobalStyles

src/components/Splitter/index.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export function Splitter(props: SplitterProps) {
2929
const isHorizontal = props.direction !== 'vertical';
3030
const contents: React.ReactNode[] = [];
3131
const containerRef = useRef<HTMLDivElement | null>(null);
32-
const zoomLevel = useStoreValue(state => state.config.zoomLevel);
3332
const leftPane = useRef<any>();
3433
const rightPane = useRef<any>();
3534
const frameId = useRef(0);
@@ -99,9 +98,6 @@ export function Splitter(props: SplitterProps) {
9998
cancelAnimationFrame(frameId.current);
10099

101100
frameId.current = requestAnimationFrame(() => {
102-
x /= zoomLevel;
103-
y /= zoomLevel;
104-
105101
const bounds = containerRef.current!.getBoundingClientRect();
106102
const value = isHorizontal ? x - bounds.left : y - bounds.top;
107103
const total = isHorizontal ? bounds.width : bounds.height;

src/index.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { App } from './components/App';
77
import { loader } from '@monaco-editor/react';
88
import { initializeEditor } from './util/editor';
99
import { runUpdateChecker } from './util/updater';
10-
import { updateTitle, updateZoom, watchNativeTheme } from './util/helpers';
10+
import { updateTitle, watchNativeTheme } from './util/helpers';
1111
import { adapter } from './adapter';
1212

1313
dayjs.extend(relativeTime);
@@ -24,9 +24,6 @@ if (adapter.isUpdateCheckSupported && updateChecker) {
2424
runUpdateChecker(lastPromptedVersion, false);
2525
}
2626

27-
// Apply zoom level
28-
updateZoom();
29-
3027
// Apply initial title
3128
updateTitle();
3229

src/store.tsx

-8
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,6 @@ const mainSlice = createSlice({
247247
state.config.resultListing = action.payload;
248248
},
249249

250-
increaseZoomLevel(state) {
251-
state.config.zoomLevel = Math.min(state.config.zoomLevel + 0.1, 2);
252-
},
253-
254-
decreaseZoomLevel(state) {
255-
state.config.zoomLevel = Math.max(state.config.zoomLevel - 0.1, 0.5);
256-
},
257-
258250
setDatabaseSchema(state, action: PayloadAction<TableDefinition[]>) {
259251
state.databaseSchema = action.payload;
260252
},

src/types.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export interface SurrealistConfig {
3333
updateChecker: boolean;
3434
queryListing: QueryListing;
3535
resultListing: ResultListing;
36-
zoomLevel: number;
3736
errorChecking: boolean;
3837
lastPromptedVersion: string | null;
3938
tabSearch: boolean;

src/util/config.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export function createBaseConfig(): SurrealistConfig {
2323
updateChecker: true,
2424
queryListing: 'history',
2525
resultListing: 'json',
26-
zoomLevel: 1,
2726
errorChecking: true,
2827
lastPromptedVersion: null,
2928
tabSearch: false

src/util/helpers.tsx

-9
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ export async function updateConfig() {
4242
return adapter.saveConfig(JSON.stringify(store.getState().config));
4343
}
4444

45-
/**
46-
* Apply the current zoom level to the document
47-
*/
48-
export function updateZoom() {
49-
const zoom = store.getState().config.zoomLevel;
50-
51-
(document.documentElement.style as any).zoom = `${zoom}`;
52-
}
53-
5445
/**
5546
* Watch for changes to the native theme
5647
*/

0 commit comments

Comments
 (0)