fix scale issues
All checks were successful
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m36s
All checks were successful
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m36s
This commit is contained in:
@@ -845,10 +845,17 @@
|
|||||||
cropCtx.lineWidth = 3;
|
cropCtx.lineWidth = 3;
|
||||||
cropCtx.strokeRect(x, y, width, height);
|
cropCtx.strokeRect(x, y, width, height);
|
||||||
|
|
||||||
// Draw dimensions text
|
// Calculate actual video dimensions for display
|
||||||
|
const video = document.getElementById('video-preview');
|
||||||
|
const scaleX = videoInfo.width / video.offsetWidth;
|
||||||
|
const scaleY = videoInfo.height / video.offsetHeight;
|
||||||
|
const actualWidth = Math.abs(Math.round(width * scaleX));
|
||||||
|
const actualHeight = Math.abs(Math.round(height * scaleY));
|
||||||
|
|
||||||
|
// Draw dimensions text (showing actual video pixels)
|
||||||
cropCtx.fillStyle = '#667eea';
|
cropCtx.fillStyle = '#667eea';
|
||||||
cropCtx.font = 'bold 14px sans-serif';
|
cropCtx.font = 'bold 14px sans-serif';
|
||||||
const text = `${Math.abs(Math.round(width))} × ${Math.abs(Math.round(height))}`;
|
const text = `${actualWidth} × ${actualHeight}`;
|
||||||
cropCtx.fillText(text, x + 5, y - 5);
|
cropCtx.fillText(text, x + 5, y - 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user