From ba673b9e538e71f94b10129ac94aa2d3ac4cb395 Mon Sep 17 00:00:00 2001 From: Sucukdeluxe Date: Mon, 2 Mar 2026 19:04:06 +0100 Subject: [PATCH] Fix bandwidth chart growing infinitely Use container.clientWidth/clientHeight instead of getBoundingClientRect and stop overriding canvas style dimensions. CSS 100% handles display sizing, canvas.width/height handles DPR-scaled render resolution. Co-Authored-By: Claude Opus 4.6 --- package.json | 2 +- src/renderer/App.tsx | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index c8bef16..b0fd280 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "real-debrid-downloader", - "version": "1.4.99", + "version": "1.5.0", "description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)", "main": "build/main/main/main.js", "author": "Sucukdeluxe", diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index d41b155..0fda829 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -155,17 +155,13 @@ const BandwidthChart = memo(function BandwidthChart({ items, running, paused }: if (!ctx) return; const dpr = window.devicePixelRatio || 1; - const rect = container.getBoundingClientRect(); - if (rect.width <= 0 || rect.height <= 0) return; + const width = container.clientWidth; + const height = container.clientHeight; + if (width <= 0 || height <= 0) return; - canvas.width = rect.width * dpr; - canvas.height = rect.height * dpr; - canvas.style.width = `${rect.width}px`; - canvas.style.height = `${rect.height}px`; + canvas.width = width * dpr; + canvas.height = height * dpr; ctx.scale(dpr, dpr); - - const width = rect.width; - const height = rect.height; const padding = { top: 20, right: 20, bottom: 30, left: 60 }; const chartWidth = width - padding.left - padding.right; const chartHeight = height - padding.top - padding.bottom;