-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0d1a91
commit 88328b9
Showing
10 changed files
with
283 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { BrowserWindow } from 'electron'; | ||
import { join } from 'node:path'; | ||
import { DIST, ICON, WEB_URL, preload, url } from '../main/contract'; | ||
|
||
const spliceImageHtml = join(DIST, './spliceImage.html'); | ||
let spliceImageWin: BrowserWindow | null = null; | ||
|
||
function createSpliceImageWin(): BrowserWindow { | ||
spliceImageWin = new BrowserWindow({ | ||
title: 'pear-rec 凭借图片', | ||
icon: ICON, | ||
height: 768, | ||
width: 1024, | ||
autoHideMenuBar: true, // 自动隐藏菜单栏 | ||
webPreferences: { | ||
preload, | ||
}, | ||
}); | ||
|
||
// spliceImageWin.webContents.openDevTools(); | ||
if (url) { | ||
spliceImageWin.loadURL(WEB_URL + `spliceImage.html`); | ||
} else { | ||
spliceImageWin.loadFile(spliceImageHtml); | ||
} | ||
|
||
spliceImageWin.once('ready-to-show', async () => { | ||
spliceImageWin?.show(); | ||
}); | ||
|
||
return spliceImageWin; | ||
} | ||
|
||
function openSpliceImageWin() { | ||
if (!spliceImageWin || spliceImageWin?.isDestroyed()) { | ||
spliceImageWin = createSpliceImageWin(); | ||
} | ||
spliceImageWin.show(); | ||
} | ||
|
||
function closeSpliceImageWin() { | ||
spliceImageWin?.close(); | ||
} | ||
|
||
export { closeSpliceImageWin, createSpliceImageWin, openSpliceImageWin }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.