Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
‘Роман committed Dec 27, 2020
2 parents 354edb8 + c44b2b7 commit b8bba27
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "perfect-pixel",
"version": "0.5.4",
"version": "0.5.5",
"description": "",
"private": true,
"main": "build/main.js",
"homepage": "./",
"scripts": {
"start": "react-scripts-ts start",
"start:electron": "yarn compile && electron ./build/main.js",
"compile": "yarn compile:react && yarn compile:electron",
"compile:react": "GENERATE_SOURCEMAP=false react-scripts-ts build",
"compile:electron": "tsc ./src/electron/** --outDir ./build",
"start:electron": "yarn compile && electron ./build/main.js",
"build:mac": "yarn compile && electron-builder --mac",
"build:win": "yarn compile && electron-builder --win --x64 --ia32",
"build:lin": "yarn compile && electron-builder --linux",
Expand Down
14 changes: 8 additions & 6 deletions src/components/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ const Home = () => {

if (imageParams) {

// размеры изображения относительно увеличения изображения
const height = imageParams.height * imageScale;
const width = imageParams.width * imageScale;

// изменим размеры окна
resizeWindow({
height: imageParams.height * imageScale,
width: imageParams.width * imageScale
});
resizeWindow({ width, height });

} else {

// вернем начальные размеры окна
Expand Down Expand Up @@ -249,8 +251,8 @@ const Home = () => {
<div className={home('ControlSection')}>
<Button onClick={onMinimizeApp} asMinimize />
<Button onClick={onCloseApp} asClose />
</div>
: null}
</div>
: null}
</header>

<div className={home('ImageContainer')}>
Expand Down
14 changes: 5 additions & 9 deletions src/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,12 @@ if (!handleSquirrelEvent(app)) {
ipcMain.on('resizeWindow', (event, sizeData: TResizeWindow) => {
if (mainWindow) {

// если данные есть
if (sizeData) {
// рассчитаем новые размеры окна относительно размеров изображения (Math.ceil для windows)
const width = Math.ceil(sizeData ? sizeData.width : minWidth);
const height = Math.ceil(sizeData ? sizeData.height + minHeight : minHeight);

// установим размеры согласно размерам изображения
mainWindow.setSize(sizeData.width, sizeData.height + minHeight);
} else {

// установим начальные размеры окна
mainWindow.setSize(minWidth, minHeight);
}
// установим размеры согласно размерам изображения
mainWindow.setSize(width, height);
}
});

Expand Down

0 comments on commit b8bba27

Please sign in to comment.