Skip to content

Commit

Permalink
fix(frontend): cursor styles and overscroll
Browse files Browse the repository at this point in the history
  • Loading branch information
kris7t committed Dec 15, 2024
1 parent 18c0b37 commit 0b15a78
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions subprojects/frontend/src/editor/EditorTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ export default styled('div', {
'.cm-editor:has(> .cm-panels-top) .cm-top-shadow': {
display: 'none',
},
'.cm-crosshair-cursor': {
cursor: 'crosshair',
},
'.cm-pointer-cursor': {
cursor: 'pointer',
},
};

const highlightingStyle: CSSObject = {
Expand Down
3 changes: 2 additions & 1 deletion subprojects/frontend/src/editor/crosshairCursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import type { Extension } from '@codemirror/state';
import { EditorView, ViewPlugin } from '@codemirror/view';

const showCrosshair = { style: 'cursor: crosshair' };
// Do not overwrite `style`, because it would interfere with the overscroll effect.
const showCrosshair = { class: 'cm-crosshair-cursor' };

/// Returns an extension that turns the pointer cursor into a
/// crosshair when Shift and Alt are held down together.
Expand Down
3 changes: 2 additions & 1 deletion subprojects/frontend/src/editor/goToDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import findToken from '../xtext/findToken';
import type EditorStore from './EditorStore';
import defineDecorationSetExtension from './defineDecorationSetExtension';

const showPointer = { style: 'cursor: pointer' };
// Do not overwrite `style`, because it would interfere with the overscroll effect.
const showPointer = { class: 'cm-pointer-cursor' };

const [setGoToDefinitionDecorations, goToDefinitionDecorations] =
defineDecorationSetExtension();
Expand Down

0 comments on commit 0b15a78

Please sign in to comment.