fix(viewport): Reset viewport state and fix CINE looping, thumbnail resolution, and dynamic tool settings (#4037)

This commit is contained in:
Alireza authored and GitHub committed 2024-04-16 11:04:48 -04:00
1 parent a6c6fff43a
commit f99a0bfb31
80 files changed
+1129 -801

No files matched your search

@@ -5,14 +5,8 @@
function getImageSrcFromImageId(cornerstone, imageId) {
return new Promise((resolve, reject) => {
const canvas = document.createElement('canvas');
// Note: the default width and height of the canvas is 300x150
// but we need to set the width and height to the same number since
// the thumbnails are usually square and we want to maintain the aspect ratio
canvas.width = 128 / window.devicePixelRatio;
canvas.height = 128 / window.devicePixelRatio;
cornerstone.utilities
.loadImageToCanvas({ canvas, imageId })
.loadImageToCanvas({ canvas, imageId, thumbnail: true })
.then(imageId => {
resolve(canvas.toDataURL());
})
@@ -219,7 +219,10 @@ function TrackedCornerstoneViewport(props) {
return (
<Component
{...props}
onElementEnabled={onElementEnabled}
onElementEnabled={evt => {
props.onElementEnabled?.(evt);
onElementEnabled(evt);
}}
onElementDisabled={onElementDisabled}
/>
);