Skip to content

Commit dcf2d06

Browse files
Add disable interactions options to non volume viewports (#171)
1 parent 9c90226 commit dcf2d06

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,10 @@ node_modules/
6363
build/
6464
dist/
6565
.vscode/
66+
67+
# misc
68+
.DS_Store
69+
.env.local
70+
.env.development.local
71+
.env.test.local
72+
.env.production.local

src/viewer.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5433,10 +5433,16 @@ class _NonVolumeImageViewer {
54335433
* reduced in size (fraction).
54345434
* @param {boolean} [options.includeIccProfile=false] - Whether ICC Profile
54355435
* should be included for correction of image colors.
5436+
* @param {boolean} [options.disableInteractions=false] - Whether interactions
5437+
* should be disabled e.g. zooming, panning, etc.
54365438
*/
54375439
constructor (options) {
54385440
this[_errorInterceptor] = options.errorInterceptor || (error => error)
54395441

5442+
if (options.disableInteractions === undefined) {
5443+
options.disableInteractions = false
5444+
}
5445+
54405446
// We also accept metadata in raw JSON format for backwards compatibility
54415447
if (options.metadata.SOPClassUID != null) {
54425448
this[_metadata] = options.metadata
@@ -5550,6 +5556,7 @@ class _NonVolumeImageViewer {
55505556
layers: [this[_imageLayer]],
55515557
view,
55525558
controls: [],
5559+
interactions: options.disableInteractions ? [] : undefined,
55535560
keyboardEventTarget: document
55545561
})
55555562

@@ -5655,12 +5662,18 @@ class OverviewImageViewer extends _NonVolumeImageViewer {
56555662
* reduced in size (fraction).
56565663
* @param {boolean} [options.includeIccProfile=false] - Whether ICC Profile
56575664
* should be included for correction of image colors.
5665+
* @param {boolean} [options.disableInteractions=false] - Whether interactions
5666+
* should be disabled e.g. zooming, panning, etc.
56585667
*/
56595668
constructor (options) {
56605669
if (options.orientation === undefined) {
56615670
options.orientation = 'horizontal'
56625671
}
56635672

5673+
if (options.disableInteractions === undefined) {
5674+
options.disableInteractions = false
5675+
}
5676+
56645677
super(options)
56655678

56665679
this[_errorInterceptor] = options.errorInterceptor || (error => error)

0 commit comments

Comments
 (0)