mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 01:05:20 +03:00
added scrollbar width to observer width.
This commit is contained in:
parent
d74021af47
commit
59f001b047
@ -10,7 +10,15 @@ export default function CameraImage({ camera, onload, searchParams = '', stretch
|
|||||||
const [hasLoaded, setHasLoaded] = useState(false);
|
const [hasLoaded, setHasLoaded] = useState(false);
|
||||||
const containerRef = useRef(null);
|
const containerRef = useRef(null);
|
||||||
const canvasRef = useRef(null);
|
const canvasRef = useRef(null);
|
||||||
const [{ width: availableWidth }] = useResizeObserver(containerRef);
|
const [{ width: containerWidth }] = useResizeObserver(containerRef);
|
||||||
|
|
||||||
|
// Add scrollbar width (when visible) to the available observer width to eliminate screen juddering.
|
||||||
|
// https://github.com/blakeblackshear/frigate/issues/1657
|
||||||
|
let scrollBarWidth;
|
||||||
|
if (window.innerWidth && document.body.offsetWidth) {
|
||||||
|
scrollBarWidth = window.innerWidth - document.body.offsetWidth;
|
||||||
|
}
|
||||||
|
const availableWidth = scrollBarWidth ? containerWidth + scrollBarWidth : containerWidth;
|
||||||
|
|
||||||
const { name } = config.cameras[camera];
|
const { name } = config.cameras[camera];
|
||||||
const { width, height } = config.cameras[camera].detect;
|
const { width, height } = config.cameras[camera].detect;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user