Skip to content

Commit

Permalink
feat: pen cursor angle change
Browse files Browse the repository at this point in the history
  • Loading branch information
dominiksta committed Aug 16, 2024
1 parent aec1025 commit 5d07df1
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 5 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ Changelog

### Added

- A new option (intended for left-handed users) in settings for changing the
angle of the pen cursor
- When closing Wournal, it will now remember the size and maximized state and
apply that to any new windows.
- Remember the last page when reopening a document.
apply that to any new windows
- Remember the last page when reopening a document

### Fixed

Expand Down
10 changes: 9 additions & 1 deletion src/renderer/app/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class Settings extends Component {
zoomUi: rx.bind(conf.partial('zoomUI')),
defaultZoomDocument: rx.bind(conf.partial('defaultZoomDocument')),
checkUpdatesOnStartup: rx.bind(conf.partial('checkUpdatesOnStartup')),
penCursorLeftAngle: rx.bind(conf.partial('penCursorLeftAngle')),
}})
]),
ui5.panel({ fields: { headerText: 'Default Tool Settings', collapsed: true }}, [
Expand Down Expand Up @@ -217,6 +218,7 @@ class UserInterfaceSettings extends Component {
zoomUi: rx.prop<number>(),
defaultZoomDocument: rx.prop<number>(),
checkUpdatesOnStartup: rx.prop<boolean>(),
penCursorLeftAngle: rx.prop<boolean>(),
}

render() {
Expand Down Expand Up @@ -260,7 +262,13 @@ class UserInterfaceSettings extends Component {
'Note that you can temporarily toggle dark mode using ',
h.i(globalCmds.toggle_dark_mode_temp.shortcut), '.'
]),

h.div(ui5.checkbox({
fields: {
checked: rx.bind(this.props.penCursorLeftAngle),
wrappingType: 'Normal',
text: 'Swap Angle of Pen Cursor (May be Desirable for Lefties)',
}
})),
]),

ui5.title({ fields: { level: 'H5' }}, 'Zoom'),
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/document/CanvasToolPen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CanvasTool } from "./CanvasTool";
import { UndoActionCanvasElements } from "./UndoActionCanvasElements";
import { WournalPage } from "./WournalPage";
import imgIdleCursor from 'res/icon/custom/pen.png';
import imgIdleCursorLeftie from 'res/icon/custom/pen-leftie.png';

export class CanvasToolPen extends CanvasTool {
#conf() {
Expand All @@ -20,7 +21,11 @@ export class CanvasToolPen extends CanvasTool {
/** The svg path for the current line */
private path: CanvasPath = null;

public idleCursor = `url('${imgIdleCursor}'), auto`;
public get idleCursor() {
return this.activePage.value.doc.config.value.penCursorLeftAngle
? `url('${imgIdleCursorLeftie}') 20 0, default`
: `url('${imgIdleCursor}'), default`;
}

public override canSetStrokeWidth = true;
public override canSetColor = true;
Expand Down
13 changes: 12 additions & 1 deletion src/renderer/persistence/ConfigDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const ConfigDTOSchema = {
'auto', 'auto_high_contrast',
] },
invertDocument: { type: 'boolean' },
penCursorLeftAngle: { type: 'boolean' },
colorPalette: {
elements: {
properties: { color: { type: 'string' }, name: { type: 'string' } }
Expand Down Expand Up @@ -212,14 +213,23 @@ export const ConfigDTOVersioner = new DTOVersioner<ConfigDTO>({
};
},

// ver 0.7 -- check for updates on startup
// ver 0.8 -- check for updates on startup
// ----------------------------------------------------------------------
0.8: (ver0_7: any) => {
return {
...ver0_7, version: 0.8,
checkUpdatesOnStartup: true,
};
},

// ver 0.9 -- customize pen cursor angle
// ----------------------------------------------------------------------
0.9: (ver0_8: any) => {
return {
...ver0_8, version: 0.9,
penCursorLeftAngle: false,
};
},
}
})

Expand All @@ -235,6 +245,7 @@ export function defaultConfig(): ConfigDTO {
// theme should likely be set to "light" by default.
theme: "auto",
invertDocument: true,
penCursorLeftAngle: false,
binds: {
rightClick: "CanvasToolEraser",
middleClick: "CanvasToolHand",
Expand Down
Binary file added src/renderer/res/icon/custom/pen-leftie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
215 changes: 215 additions & 0 deletions src/renderer/res/icon/custom/pen-leftie.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5d07df1

Please sign in to comment.