Fix launch cache sanitization and progress layout
This commit is contained in:
@@ -41,6 +41,7 @@ const UI_SCALE_MULTIPLIER = 1.5
|
||||
|
||||
let responsiveLayoutFrame = null
|
||||
let lastAppliedZoomFactor = null
|
||||
let lastLaunchContentWidth = 0
|
||||
|
||||
function clamp(value, min, max){
|
||||
return Math.min(Math.max(value, min), max)
|
||||
@@ -58,19 +59,35 @@ function syncLaunchDetailWidths(){
|
||||
return
|
||||
}
|
||||
|
||||
const launchContentWidth = launchContent.getBoundingClientRect().width
|
||||
const measuredLaunchContentWidth = Math.ceil(launchContent.getBoundingClientRect().width)
|
||||
if(measuredLaunchContentWidth > 0){
|
||||
lastLaunchContentWidth = measuredLaunchContentWidth
|
||||
}
|
||||
|
||||
const launchContentWidth = lastLaunchContentWidth > 0
|
||||
? lastLaunchContentWidth
|
||||
: Math.ceil(launchDetails.parentElement?.getBoundingClientRect().width ?? 0)
|
||||
|
||||
if(launchContentWidth <= 0){
|
||||
return
|
||||
}
|
||||
|
||||
const launchButtonWidth = launchButton.getBoundingClientRect().width
|
||||
const labelWidth = Math.max(64, Math.ceil(launchButtonWidth * 0.48))
|
||||
const progressWidth = Math.max(220, Math.floor(launchContentWidth - labelWidth - 48))
|
||||
|
||||
launchDetails.style.width = `${Math.ceil(launchContentWidth)}px`
|
||||
launchDetails.style.maxWidth = `${Math.ceil(launchContentWidth)}px`
|
||||
launchProgress.style.width = `${progressWidth}px`
|
||||
launchDetailsRight.style.width = `${progressWidth}px`
|
||||
launchDetailsRight.style.maxWidth = `${progressWidth}px`
|
||||
launchProgressLabel.style.width = `${labelWidth}px`
|
||||
launchProgressLabel.style.minWidth = `${labelWidth}px`
|
||||
launchProgressLabel.style.maxWidth = `${labelWidth}px`
|
||||
}
|
||||
|
||||
window.syncLaunchDetailWidths = syncLaunchDetailWidths
|
||||
|
||||
function applyResponsiveLayout(){
|
||||
const currentWindow = remote.getCurrentWindow()
|
||||
const contentBounds = currentWindow.getContentBounds()
|
||||
|
||||
Reference in New Issue
Block a user