refactor(viewport): Remove resize detector and optimize viewport resizing logic (#5006)

This commit is contained in:
Alireza authored and GitHub committed 2025-05-05 11:27:26 -04:00
1 parent 6337d2e9cb
commit 383f45823c
5 files changed
+38 -46

No files matched your search

+2 -14
View File
@@ -1,5 +1,4 @@
import React, { useEffect, useCallback, useRef, useMemo } from 'react';
import { useResizeDetector } from 'react-resize-detector';
import React, { useEffect, useCallback, useRef } from 'react';
import { Types, MeasurementService } from '@ohif/core';
import { ViewportGrid, ViewportPane } from '@ohif/ui-next';
import { useViewportGrid } from '@ohif/ui-next';
@@ -13,14 +12,6 @@ function ViewerViewportGrid(props: withAppTypes) {
const { layout, activeViewportId, viewports, isHangingProtocolLayout } = viewportGrid;
const { numCols, numRows } = layout;
const { ref: resizeRef } = useResizeDetector({
refreshMode: 'debounce',
refreshRate: 7,
refreshOptions: { leading: true },
onResize: () => {
viewportGridService.setViewportGridSizeChanged();
},
});
const layoutHash = useRef(null);
const {
@@ -444,10 +435,7 @@ function ViewerViewportGrid(props: withAppTypes) {
}
return (
<div
ref={resizeRef}
className="border-input h-[calc(100%-0.25rem)] w-full border"
>
<div className="border-input h-[calc(100%-0.25rem)] w-full border">
<ViewportGrid
numRows={numRows}
numCols={numCols}