mirror of
https://github.com/fanchenio/DawnLauncher.git
synced 2025-07-13 12:52:10 +08:00
修复'锁定尺寸'在某些状况下没有成功的问题。
This commit is contained in:
parent
5c791874c6
commit
4e3947ab7e
@ -67,11 +67,6 @@ function createMainWindow() {
|
||||
global.addon.removeWindowAnimation(
|
||||
mainWindow.getNativeWindowHandle().readInt32LE(0)
|
||||
);
|
||||
// 恢复上一次的位置
|
||||
let bounds = cacheData.cacheStore.get("mainWindowBounds");
|
||||
if (bounds) {
|
||||
mainWindow.setBounds(bounds);
|
||||
}
|
||||
// 永远居中不可移动
|
||||
if (global.setting.general.alwaysCenter) {
|
||||
mainWindow.setMovable(false);
|
||||
@ -82,8 +77,39 @@ function createMainWindow() {
|
||||
if (global.setting.general.alwaysTop) {
|
||||
mainWindow.setAlwaysOnTop(true, "screen-saver");
|
||||
}
|
||||
// 恢复上一次的位置
|
||||
let bounds: any = cacheData.cacheStore.get("mainWindowBounds");
|
||||
// 锁定尺寸
|
||||
mainWindow.setResizable(!global.setting.general.lockSize);
|
||||
// 如果是锁定尺寸的话,使用锁定尺寸来设置窗口尺寸
|
||||
if (global.setting.general.lockSize) {
|
||||
let lockSizeBounds: any = cacheData.cacheStore.get(
|
||||
"mainWindowLockSizeBounds"
|
||||
);
|
||||
if (lockSizeBounds) {
|
||||
if (bounds) {
|
||||
bounds.width = lockSizeBounds.width;
|
||||
bounds.height = lockSizeBounds.height;
|
||||
} else {
|
||||
bounds = {
|
||||
width: lockSizeBounds.width,
|
||||
height: lockSizeBounds.height,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
if (bounds) {
|
||||
cacheData.cacheStore.set("mainWindowLockSizeBounds", bounds);
|
||||
} else {
|
||||
cacheData.cacheStore.set(
|
||||
"mainWindowLockSizeBounds",
|
||||
mainWindow.getBounds()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bounds) {
|
||||
mainWindow.setBounds(bounds);
|
||||
}
|
||||
// 托盘
|
||||
createTray(!global.setting.general.hideTray);
|
||||
// 永远居中
|
||||
|
@ -16,6 +16,7 @@ import { statSync, mkdirSync, copyFileSync, readFileSync } from "node:fs";
|
||||
import mime from "mime";
|
||||
import { checkInvalid } from "../item";
|
||||
import { updateItemOpenNumberSortToDefualt } from "../classification";
|
||||
import cacheData from "../commons/cacheData";
|
||||
|
||||
export default function () {
|
||||
// 创建设置窗口
|
||||
@ -91,6 +92,13 @@ export default function () {
|
||||
// 锁定尺寸
|
||||
ipcMain.on("setLockSize", (event, args) => {
|
||||
global.mainWindow.setResizable(!args);
|
||||
if (args) {
|
||||
// 存储主窗口尺寸
|
||||
cacheData.cacheStore.set(
|
||||
"mainWindowLockSizeBounds",
|
||||
global.mainWindow.getBounds()
|
||||
);
|
||||
}
|
||||
});
|
||||
// 固定位置
|
||||
ipcMain.on("setFixedPosition", (event, args) => {
|
||||
|
Loading…
Reference in New Issue
Block a user