Skip to content

Commit

Permalink
feat: add pen cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
F-star committed Mar 2, 2024
1 parent 47a6369 commit a68cdef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions packages/core/src/cursor_manager/cursor.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions packages/core/src/cursor_manager/cursor_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@ export type ICursor =
| 'pointer'
| 'crosshair'
| 'text'
| 'wait'
| 'help'
| 'not-allowed'
| 'zoom-in'
| 'zoom-out';
| 'pen';

export class CursorManger {
private cursor!: ICursor;
// the cursors with custom style, need to add class to canvas element
private customClassCursor = new Set<ICursor>(['default', 'move']);
private customClassCursor = new Set<ICursor>(['default', 'move', 'pen']);

constructor(private editor: Editor) {
this.setCursor('default');
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tools/tool_draw_path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class DrawPathTool implements ITool {
static readonly hotkey = HOTKEY;
readonly type = TYPE;
readonly hotkey = HOTKEY;
cursor: ICursor = 'default';
cursor: ICursor = 'pen';

private startPoint: IPoint | null = null;
private path: Path | null = null;
Expand Down

0 comments on commit a68cdef

Please sign in to comment.