Skip to content

Commit

Permalink
feat(viewer): apply default viewport option value when initial setting
Browse files Browse the repository at this point in the history
  • Loading branch information
LTakhyunKim committed Oct 25, 2022
1 parent fdf02af commit 25ea04c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libs/insight-viewer/src/hooks/useImageDisplay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { displayImage, getDefaultViewportForImage } from '../../utils/cornerston
import { formatViewerViewport, formatCornerstoneViewport } from '../../utils/common/formatViewport'
import { BasicViewport } from '../../types'
import { UseImageDisplay } from './types'
import { defaultViewportOptions } from '../useViewport'

let imageSeriesKey: string

Expand Down Expand Up @@ -60,7 +61,10 @@ const useImageDisplay: UseImageDisplay = ({ element, image, viewportRef, onViewp

// Updates the viewport prop of Viewer.
if (onViewportChange) {
onViewportChange(formatViewerViewport(viewport))
onViewportChange({
...formatViewerViewport(viewport),
_viewportOptions: viewportRef.current._viewportOptions ?? defaultViewportOptions,
})
}
}, [image, element, viewportRef, onViewportChange])
}
Expand Down

0 comments on commit 25ea04c

Please sign in to comment.