diff --git a/release/app/package-lock.json b/release/app/package-lock.json index d49a6df..fc6c114 100644 --- a/release/app/package-lock.json +++ b/release/app/package-lock.json @@ -1,12 +1,12 @@ { "name": "plainprinter", - "version": "0.0.5", + "version": "0.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "plainprinter", - "version": "0.0.5", + "version": "0.1.0", "hasInstallScript": true, "license": "GPL-3.0-only", "dependencies": { diff --git a/release/app/package.json b/release/app/package.json index c2ee21c..22ef92c 100644 --- a/release/app/package.json +++ b/release/app/package.json @@ -1,7 +1,7 @@ { "name": "plainprinter", "productName": "PlainPrinter", - "version": "0.1.0", + "version": "0.2.0", "description": "Plain screen printer", "main": "./dist/main/main.js", "author": { diff --git a/src/main/main.ts b/src/main/main.ts index f1b5439..fb35bd5 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -98,8 +98,8 @@ const createWindow = async () => { mainWindow = new BrowserWindow({ show: false, - width: 512, - height: 364, + width: 800, + height: 400, icon: getAssetPath('icon.png'), webPreferences: { preload: app.isPackaged diff --git a/src/renderer/components/printer/Main.tsx b/src/renderer/components/printer/Main.tsx index 4eb16a4..e01f39c 100644 --- a/src/renderer/components/printer/Main.tsx +++ b/src/renderer/components/printer/Main.tsx @@ -18,6 +18,43 @@ const Main = () => { const [pageNum, setPageNum] = useState(0); const [printing, setPrinting] = useState(false); + const setFrameCoordValue = (label: string, value: number) => { + if (frameCoord) { + switch (label) { + case 'x0': + setFrameCoord({ ...frameCoord, x0: value }); + break; + case 'x1': + setFrameCoord({ ...frameCoord, x1: value }); + break; + case 'y0': + frameCoord.y0 = value; + setFrameCoord({ ...frameCoord, y0: value }); + break; + case 'y1': + setFrameCoord({ ...frameCoord, y1: value }); + break; + default: + break; + } + } + }; + + const setNextCoordValue = (label: string, value: number) => { + if (nextCoord) { + switch (label) { + case 'x': + setNextCoord({ ...nextCoord, x0: value, x1: value }); + break; + case 'y': + setNextCoord({ ...nextCoord, y0: value, y1: value }); + break; + default: + break; + } + } + }; + const handleCloseScreen = (c: Coord) => { if (c.select === 'frame') { setFrameCoord({ ...c }); @@ -80,8 +117,39 @@ const Main = () => { {frameCoord ? (

- Rectangle: ({frameCoord.x0}, {frameCoord.y0}) ({frameCoord.x1},{' '} - {frameCoord.y1}) + Rectangle: [ + + setFrameCoordValue('x0', parseInt(e.target.value, 10)) + } + /> + ,{' '} + + setFrameCoordValue('y0', parseInt(e.target.value, 10)) + } + /> + ] [ + + setFrameCoordValue('x1', parseInt(e.target.value, 10)) + } + /> + ,{' '} + + setFrameCoordValue('y1', parseInt(e.target.value, 10)) + } + /> + ]

setFrameCoord(undefined)} @@ -105,8 +173,23 @@ const Main = () => { {nextCoord ? (

- Point: ({(nextCoord.x0 + nextCoord.x1) / 2},{' '} - {(nextCoord.y0 + nextCoord.y1) / 2}) + Point: [ + + setNextCoordValue('x', parseInt(e.target.value, 10)) + } + /> + ,{' '} + + setNextCoordValue('y', parseInt(e.target.value, 10)) + } + /> + ]

setNextCoord(undefined)}