🐛 Fix(custom): fix rename window bug

ISSUES CLOSED: 
This commit is contained in:
Kuingsmile 2024-06-24 22:55:02 +08:00
parent 658d6840b1
commit 0b670a8361
2 changed files with 7 additions and 3 deletions
src/main
apis/app/window
server

View File

@ -235,7 +235,7 @@ windowList.set(IWindowList.RENAME_WINDOW, {
if (currentWindow && currentWindow.isVisible()) { if (currentWindow && currentWindow.isVisible()) {
// bounds: { x: 821, y: 75, width: 800, height: 450 } // bounds: { x: 821, y: 75, width: 800, height: 450 }
const bounds = currentWindow.getBounds() const bounds = currentWindow.getBounds()
const positionX = bounds.x + bounds.width / 2 - 150 let positionX = bounds.x + bounds.width / 2 - 150
let positionY let positionY
// if is the settingWindow // if is the settingWindow
if (bounds.height > 400) { if (bounds.height > 400) {
@ -244,6 +244,8 @@ windowList.set(IWindowList.RENAME_WINDOW, {
// if is the miniWindow // if is the miniWindow
positionY = bounds.y + bounds.height / 2 positionY = bounds.y + bounds.height / 2
} }
positionX = Math.floor(positionX)
positionY = Math.floor(positionY)
window.setPosition(positionX, positionY, false) window.setPosition(positionX, positionY, false)
} }
} }
@ -258,13 +260,15 @@ windowList.set(IWindowList.TOOLBOX_WINDOW, {
const currentWindow = windowManager.getAvailableWindow(true) const currentWindow = windowManager.getAvailableWindow(true)
if (currentWindow && currentWindow.isVisible()) { if (currentWindow && currentWindow.isVisible()) {
const bounds = currentWindow.getBounds() const bounds = currentWindow.getBounds()
const positionX = bounds.x + bounds.width / 2 - 400 let positionX = bounds.x + bounds.width / 2 - 400
let positionY let positionY
if (bounds.height > 400) { if (bounds.height > 400) {
positionY = bounds.y + bounds.height / 2 - 225 positionY = bounds.y + bounds.height / 2 - 225
} else { } else {
positionY = bounds.y + bounds.height / 2 positionY = bounds.y + bounds.height / 2
} }
positionX = Math.floor(positionX)
positionY = Math.floor(positionY)
window.setPosition(positionX, positionY, false) window.setPosition(positionX, positionY, false)
} }
} }

View File

@ -70,7 +70,7 @@ router.post(
let needRestore = false let needRestore = false
if (picbed) { if (picbed) {
const currentPicBed = picgo.getConfig<IStringKeyMap>('picBed') || ({} as IStringKeyMap) const currentPicBed = picgo.getConfig<IStringKeyMap>('picBed') || ({} as IStringKeyMap)
currentPicBedType = currentPicBed.current || '' currentPicBedType = currentPicBed.uploader || currentPicBed.current || 'smms'
currentPicBedConfig = currentPicBed[currentPicBedType] || ({} as IStringKeyMap) currentPicBedConfig = currentPicBed[currentPicBedType] || ({} as IStringKeyMap)
currentPicBedConfigId = currentPicBedConfig._id currentPicBedConfigId = currentPicBedConfig._id
const configName = urlparams?.get('configName') || currentPicBed[picbed]?._configName const configName = urlparams?.get('configName') || currentPicBed[picbed]?._configName