MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / resize

Method resize

src/worker/ChartGPUWorkerProxy.ts:1428–1453  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1426 }
1427
1428 resize(): void {
1429 if (this.isDisposed) {
1430 return; // Silent no-op for disposed charts
1431 }
1432
1433 // Get current canvas dimensions from container
1434 const canvas = this.container.querySelector('canvas');
1435 if (!canvas) {
1436 console.warn('ChartGPUWorkerProxy.resize(): Canvas not found in container');
1437 return;
1438 }
1439
1440 const rect = canvas.getBoundingClientRect();
1441 const dpr = window.devicePixelRatio || 1;
1442 const width = Math.max(1, rect.width); // CSS pixels
1443 const height = Math.max(1, rect.height); // CSS pixels
1444
1445 this.sendMessage({
1446 type: 'resize',
1447 chartId: this.chartId,
1448 width,
1449 height,
1450 devicePixelRatio: dpr,
1451 requestRender: true,
1452 });
1453 }
1454
1455 dispose(): void {
1456 if (this.isDisposed) {

Callers

nothing calls this directly

Calls 1

sendMessageMethod · 0.95

Tested by

no test coverage detected