fix(modes): don't attempt to retrieve a stage index if HPs (#4552)
Co-authored-by: Ibrahim <93064150+IbrahimCSAE@users.noreply.github.com> Co-authored-by: Ștefan Silviu-Alexandru <silviu.stefan@atta.systems>
This commit is contained in:
12 files changed
+43
-48
No files matched your search
@@ -48,7 +48,7 @@
|
||||
"@babel/runtime": "^7.20.13",
|
||||
"@cornerstonejs/adapters": "^2.2.20",
|
||||
"@cornerstonejs/core": "^2.2.20",
|
||||
"@kitware/vtk.js": "32.1.0",
|
||||
"@kitware/vtk.js": "32.1.1",
|
||||
"react-color": "^2.19.3"
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@
|
||||
"@babel/runtime": "^7.20.13",
|
||||
"@cornerstonejs/adapters": "^2.2.20",
|
||||
"@cornerstonejs/core": "^2.2.20",
|
||||
"@kitware/vtk.js": "32.1.0",
|
||||
"@kitware/vtk.js": "32.1.1",
|
||||
"react-color": "^2.19.3"
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@
|
||||
"@cornerstonejs/core": "^2.2.20",
|
||||
"@cornerstonejs/tools": "^2.2.20",
|
||||
"@icr/polyseg-wasm": "^0.4.0",
|
||||
"@kitware/vtk.js": "32.1.0",
|
||||
"@kitware/vtk.js": "32.1.1",
|
||||
"html2canvas": "^1.4.1",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"lodash.merge": "^4.6.2",
|
||||
|
||||
@@ -130,6 +130,21 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
|
||||
* individual resize observers
|
||||
*/
|
||||
public resize(isGridResize = false) {
|
||||
// https://stackoverflow.com/a/26279685
|
||||
// This resize() call, among other things, rerenders the viewports. But when the entire viewer is
|
||||
// display: none'd, it makes the size of all hidden elements 0, including the viewport canvas and its containers.
|
||||
// Even if the viewer is later displayed again, trying to render when the size is 0 permanently "breaks" the
|
||||
// viewport, making it fully black even after the size is normal again. So just ignore resize events when hidden:
|
||||
const areViewportsHidden = Array.from(this.viewportsById.values()).every(viewportInfo => {
|
||||
const element = viewportInfo.getElement();
|
||||
|
||||
return element.clientWidth === 0 && element.clientHeight === 0;
|
||||
});
|
||||
if (areViewportsHidden) {
|
||||
console.warn('Ignoring resize when viewports have size 0');
|
||||
return;
|
||||
}
|
||||
|
||||
// if there is a grid resize happening, it means the viewport grid
|
||||
// has been manipulated (e.g., panels closed, added, etc.) and we need
|
||||
// to resize all viewports, so we will add a timeout here to make sure
|
||||
|
||||
Reference in new issue
Block a user