Skip to content

Commit

Permalink
🐛 Fix(custom): fix rename window bug
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #58
  • Loading branch information
Kuingsmile committed Jun 24, 2024
1 parent 658d684 commit 0b670a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/main/apis/app/window/windowList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ windowList.set(IWindowList.RENAME_WINDOW, {
if (currentWindow && currentWindow.isVisible()) {
// bounds: { x: 821, y: 75, width: 800, height: 450 }
const bounds = currentWindow.getBounds()
const positionX = bounds.x + bounds.width / 2 - 150
let positionX = bounds.x + bounds.width / 2 - 150
let positionY
// if is the settingWindow
if (bounds.height > 400) {
Expand All @@ -244,6 +244,8 @@ windowList.set(IWindowList.RENAME_WINDOW, {
// if is the miniWindow
positionY = bounds.y + bounds.height / 2
}
positionX = Math.floor(positionX)
positionY = Math.floor(positionY)
window.setPosition(positionX, positionY, false)
}
}
Expand All @@ -258,13 +260,15 @@ windowList.set(IWindowList.TOOLBOX_WINDOW, {
const currentWindow = windowManager.getAvailableWindow(true)
if (currentWindow && currentWindow.isVisible()) {
const bounds = currentWindow.getBounds()
const positionX = bounds.x + bounds.width / 2 - 400
let positionX = bounds.x + bounds.width / 2 - 400
let positionY
if (bounds.height > 400) {
positionY = bounds.y + bounds.height / 2 - 225
} else {
positionY = bounds.y + bounds.height / 2
}
positionX = Math.floor(positionX)
positionY = Math.floor(positionY)
window.setPosition(positionX, positionY, false)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/server/routerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ router.post(
let needRestore = false
if (picbed) {
const currentPicBed = picgo.getConfig<IStringKeyMap>('picBed') || ({} as IStringKeyMap)
currentPicBedType = currentPicBed.current || ''
currentPicBedType = currentPicBed.uploader || currentPicBed.current || 'smms'
currentPicBedConfig = currentPicBed[currentPicBedType] || ({} as IStringKeyMap)
currentPicBedConfigId = currentPicBedConfig._id
const configName = urlparams?.get('configName') || currentPicBed[picbed]?._configName
Expand Down

0 comments on commit 0b670a8

Please sign in to comment.