Skip to content

Commit

Permalink
fix #1795: use OS/browser zoom in config height
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed Jul 26, 2024
1 parent 1dd9e95 commit 6e18fbe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions js/dlg/config-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,17 @@ async function configDialog(style) {
let {offsetWidth: width, offsetHeight: height} = contents;
contents.style = '';

const dpr = devicePixelRatio;
const elPicker = document.body.appendChild(
$create('.colorpicker-popup', {style: 'display: none!important'}));
const PADDING = 50;
const MIN_WIDTH = parseFloat(getComputedStyle(elPicker).width) || 350;
const MIN_HEIGHT = 250 + PADDING;
const PADDING = 50 / dpr;
const MIN_WIDTH = parseFloat(getComputedStyle(elPicker).width) || 350 / dpr;
const MIN_HEIGHT = 250 / dpr + PADDING;
elPicker.remove();

const bs = document.body.style;
width = clamp(width + PADDING, MIN_WIDTH, 798);
height = clamp(height + PADDING, MIN_HEIGHT, parseInt(bs.maxHeight) || 598);
width = clamp(width + PADDING, MIN_WIDTH, 798 / dpr);
height = clamp(height + PADDING, MIN_HEIGHT, parseInt(bs.maxHeight) || 598 / dpr);
bodyStyle = bs.cssText;
bs.cssText = bodyStyle.replace(/((min|max)-width|min-height)\s*:[^;]+|;\s*$/g, '') + `;
min-width:${width}px !important;
Expand Down
2 changes: 1 addition & 1 deletion js/dlg/message-box.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
align-items: center;
justify-content: center;
> div {
max-height: 570px;
max-height: 90vh;
max-width: 90vw;
top: auto;
right: auto;
Expand Down

0 comments on commit 6e18fbe

Please sign in to comment.