v0.12.0-hotfix1
This commit is contained in:
+7
-3
@@ -182,10 +182,14 @@ function prepareCanvas(canvas, height) {
|
||||
const wrap = canvas.parentElement;
|
||||
const wrapWidth = Math.floor(wrap?.clientWidth || rect.width || 720);
|
||||
const card = canvas.closest('.history-chart-card');
|
||||
const fullscreenHeight = chartCardIsFullscreen(card) ? Math.floor(wrap?.clientHeight || 0) : 0;
|
||||
const actualHeight = Math.max(height, fullscreenHeight || 0);
|
||||
const fullscreen = chartCardIsFullscreen(card);
|
||||
const fullscreenHeight = fullscreen ? Math.floor(wrap?.clientHeight || 0) : 0;
|
||||
const actualHeight = fullscreenHeight || height;
|
||||
const zoom = clamp(Number(canvas.dataset.chartZoom || 1), 1, 4);
|
||||
const width = Math.max(720, Math.floor(Math.max(720, wrapWidth) * zoom));
|
||||
// Regular charts keep a useful minimum plotting width and may scroll horizontally.
|
||||
// In fullscreen, 100% zoom must fit the available viewport instead of forcing 720px.
|
||||
const baseWidth = fullscreen ? Math.max(1, wrapWidth) : Math.max(720, wrapWidth);
|
||||
const width = Math.max(1, Math.floor(baseWidth * zoom));
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
canvas.width = width * dpr; canvas.height = actualHeight * dpr;
|
||||
canvas.style.width = `${width}px`; canvas.style.height = `${actualHeight}px`;
|
||||
|
||||
Reference in New Issue
Block a user