Skip to content

Commit 94492e1

Browse files
committed
fix: make thumbnails more clear on both narrow and wide windows
1 parent fe9daf9 commit 94492e1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/zen/tabs/ZenCtrlTabPanel.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class nsZenCtrlTabPanel extends nsZenDOMOperatedFeature {
2828
static CARD_HEIGHT = 220;
2929
static MAX_VISIBLE_CARDS = 5;
3030
static PANEL_PADDING = 16;
31-
static THUMBNAIL_CANVAS_HEIGHT = 300;
3231

3332
#isOpen = false;
3433
#currentIndex = 0;
@@ -206,9 +205,12 @@ class nsZenCtrlTabPanel extends nsZenDOMOperatedFeature {
206205
this.#actualVisibleCards = Math.min(this.#tabList.length, maxCards);
207206

208207
const browserRect = gBrowser.tabbox.getBoundingClientRect();
209-
const thumbnailHeight = nsZenCtrlTabPanel.THUMBNAIL_CANVAS_HEIGHT;
208+
// Clamp width to 300 on narrow viewports and 700 on wide viewports
210209
const thumbnailWidth = Math.round(
211-
thumbnailHeight * (browserRect.width / browserRect.height)
210+
Math.min(Math.max((browserRect.width / browserRect.height) * 500, 300), 700)
211+
);
212+
const thumbnailHeight = Math.round(
213+
thumbnailWidth * (browserRect.height / browserRect.width)
212214
);
213215

214216
await this.#cacheThumbnailsForVisible(thumbnailWidth, thumbnailHeight);

0 commit comments

Comments
 (0)