From 5d07df113f6eb8b864d84613c2ced7100eda0bd2 Mon Sep 17 00:00:00 2001 From: dominiksta Date: Fri, 16 Aug 2024 18:31:18 +0200 Subject: [PATCH] feat: pen cursor angle change --- CHANGELOG.md | 6 +- src/renderer/app/settings.ts | 10 +- src/renderer/document/CanvasToolPen.ts | 7 +- src/renderer/persistence/ConfigDTO.ts | 13 +- src/renderer/res/icon/custom/pen-leftie.png | Bin 0 -> 629 bytes src/renderer/res/icon/custom/pen-leftie.svg | 215 ++++++++++++++++++++ 6 files changed, 246 insertions(+), 5 deletions(-) create mode 100644 src/renderer/res/icon/custom/pen-leftie.png create mode 100644 src/renderer/res/icon/custom/pen-leftie.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 05c4119..c1cbf31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/renderer/app/settings.ts b/src/renderer/app/settings.ts index 62275d0..497c60e 100644 --- a/src/renderer/app/settings.ts +++ b/src/renderer/app/settings.ts @@ -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 }}, [ @@ -217,6 +218,7 @@ class UserInterfaceSettings extends Component { zoomUi: rx.prop(), defaultZoomDocument: rx.prop(), checkUpdatesOnStartup: rx.prop(), + penCursorLeftAngle: rx.prop(), } render() { @@ -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'), diff --git a/src/renderer/document/CanvasToolPen.ts b/src/renderer/document/CanvasToolPen.ts index 32af371..a0c3694 100644 --- a/src/renderer/document/CanvasToolPen.ts +++ b/src/renderer/document/CanvasToolPen.ts @@ -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() { @@ -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; diff --git a/src/renderer/persistence/ConfigDTO.ts b/src/renderer/persistence/ConfigDTO.ts index 719dc49..c210200 100644 --- a/src/renderer/persistence/ConfigDTO.ts +++ b/src/renderer/persistence/ConfigDTO.ts @@ -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' } } @@ -212,7 +213,7 @@ export const ConfigDTOVersioner = new DTOVersioner({ }; }, - // ver 0.7 -- check for updates on startup + // ver 0.8 -- check for updates on startup // ---------------------------------------------------------------------- 0.8: (ver0_7: any) => { return { @@ -220,6 +221,15 @@ export const ConfigDTOVersioner = new DTOVersioner({ checkUpdatesOnStartup: true, }; }, + + // ver 0.9 -- customize pen cursor angle + // ---------------------------------------------------------------------- + 0.9: (ver0_8: any) => { + return { + ...ver0_8, version: 0.9, + penCursorLeftAngle: false, + }; + }, } }) @@ -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", diff --git a/src/renderer/res/icon/custom/pen-leftie.png b/src/renderer/res/icon/custom/pen-leftie.png new file mode 100644 index 0000000000000000000000000000000000000000..96d284e212abc9ed3fc46c7b4ca75e51217fde23 GIT binary patch literal 629 zcmV-*0*d{KP)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H10s=`y zK~y-6t<$}$QUMsp@h9&Ql~6e9MLT%Jx1+|vx3Ey8oU#U$42N(iL1=I>yu*c-K(fJG zLqmg$n>4iuO>GSgEk|bm@nVwFk zvk?)=UfFCm`=Zfkhv#`trBZFQTJ5aU>D=k}`)_4W#2zK#6bi?y)d~P`czF2T>-FAMgz-F|DwRs# zBuT<%vq8CB9=P4^Te1+N(Rfp*(>-uHo%u?oasmMB^%})uaUcl7by=9-@2~3h`W44< zgKD*Uy2T2G!dIT> + + + + + + + + + + + + + + + + + + + + + + + + + + + +