Fix OHIF global variable definition bug in OHIF Viewer, moved resizeViewportElements to viewerbase
This commit is contained in:
parent
37fa29cce4
commit
86c8a32e2a
@ -1,16 +1,3 @@
|
|||||||
var resizeTimer;
|
|
||||||
|
|
||||||
// TODO= Move this and resizeViewportElements to viewerbase
|
|
||||||
function handleResize() {
|
|
||||||
// Avoid doing DOM manipulation during the resize handler
|
|
||||||
// because it is fired very often.
|
|
||||||
// Resizing is therefore performed 100 ms after the resize event stops.
|
|
||||||
clearTimeout(resizeTimer);
|
|
||||||
resizeTimer = setTimeout(function() {
|
|
||||||
resizeViewportElements();
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
Template.viewer.onCreated(function() {
|
Template.viewer.onCreated(function() {
|
||||||
// Attach the Window resize listener
|
// Attach the Window resize listener
|
||||||
$(window).on('resize', handleResize);
|
$(window).on('resize', handleResize);
|
||||||
|
|||||||
@ -1,25 +1,10 @@
|
|||||||
function resizeViewports() {
|
|
||||||
log.info("viewer resizeViewports");
|
|
||||||
|
|
||||||
// Handle resizing of image viewer viewports
|
|
||||||
// For some reason, this seems to need to be on
|
|
||||||
// another delay, or the resizing won't work properly
|
|
||||||
viewportResizeTimer = setTimeout(function() {
|
|
||||||
var elements = $('.imageViewerViewport');
|
|
||||||
elements.each(function(index) {
|
|
||||||
var element = this;
|
|
||||||
if (!element) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cornerstone.resize(element, true);
|
|
||||||
});
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Template.viewer.onCreated(function() {
|
Template.viewer.onCreated(function() {
|
||||||
|
// Attach the Window resize listener
|
||||||
|
$(window).on('resize', handleResize);
|
||||||
|
|
||||||
log.info("viewer onCreated");
|
log.info("viewer onCreated");
|
||||||
|
|
||||||
OHIF = {
|
OHIF = window.OHIF || {
|
||||||
viewer: {}
|
viewer: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -96,15 +81,4 @@ Template.viewer.onCreated(function() {
|
|||||||
Template.viewer.onDestroyed(function() {
|
Template.viewer.onDestroyed(function() {
|
||||||
log.info("onDestroyed");
|
log.info("onDestroyed");
|
||||||
OHIF.viewer.updateImageSynchronizer.destroy();
|
OHIF.viewer.updateImageSynchronizer.destroy();
|
||||||
});
|
|
||||||
|
|
||||||
// Avoid doing DOM manipulation during the resize handler
|
|
||||||
// because it is fired very often.
|
|
||||||
// Resizing is therefore performed 100 ms after the resize event stops.
|
|
||||||
var resizeTimer;
|
|
||||||
$(window).on('resize', function() {
|
|
||||||
clearTimeout(resizeTimer);
|
|
||||||
resizeTimer = setTimeout(function() {
|
|
||||||
resizeViewports();
|
|
||||||
}, 100);
|
|
||||||
});
|
});
|
||||||
@ -65,7 +65,7 @@
|
|||||||
bottom: 0
|
bottom: 0
|
||||||
overflow: auto
|
overflow: auto
|
||||||
width: 100%
|
width: 100%
|
||||||
|
padding-bottom: 20px
|
||||||
|
|
||||||
tr.selectedRow
|
tr.selectedRow
|
||||||
background: #F5F5F5 !important
|
background: #F5F5F5 !important
|
||||||
|
|||||||
@ -62,13 +62,11 @@ Package.onUse(function (api) {
|
|||||||
|
|
||||||
// Library functions
|
// Library functions
|
||||||
api.addFiles('lib/uuid.js', 'client');
|
api.addFiles('lib/uuid.js', 'client');
|
||||||
api.addFiles('lib/resizeViewportElements.js', 'client');
|
|
||||||
api.addFiles('lib/toggleLesionTrackerTools.js', 'client');
|
api.addFiles('lib/toggleLesionTrackerTools.js', 'client');
|
||||||
api.addFiles('lib/clearTools.js', 'client');
|
api.addFiles('lib/clearTools.js', 'client');
|
||||||
|
|
||||||
// Export lesionTable function for activate measurements
|
// Export lesionTable function for activate measurements
|
||||||
api.export('activateLesion','client');
|
api.export('activateLesion','client');
|
||||||
api.export('resizeViewportElements','client');
|
|
||||||
api.export('toggleLesionTrackerTools', 'client');
|
api.export('toggleLesionTrackerTools', 'client');
|
||||||
api.export('clearTools', 'client');
|
api.export('clearTools', 'client');
|
||||||
api.export('measurementManagerDAL', 'client');
|
api.export('measurementManagerDAL', 'client');
|
||||||
|
|||||||
@ -23,6 +23,13 @@ Template.playClipButton.helpers({
|
|||||||
'isPlaying': function() {
|
'isPlaying': function() {
|
||||||
Session.get('UpdateCINE');
|
Session.get('UpdateCINE');
|
||||||
var activeViewport = Session.get('activeViewport');
|
var activeViewport = Session.get('activeViewport');
|
||||||
|
|
||||||
|
// TODO=Check best way to make sure this is always defined
|
||||||
|
// Right now it is initialized in enableHotkeys AND in
|
||||||
|
// imageViewer onCreated, but this appears to break some things
|
||||||
|
if (!OHIF.viewer.isPlaying) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return !!OHIF.viewer.isPlaying[activeViewport];
|
return !!OHIF.viewer.isPlaying[activeViewport];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,3 +1,15 @@
|
|||||||
|
var resizeTimer;
|
||||||
|
|
||||||
|
handleResize = function() {
|
||||||
|
// Avoid doing DOM manipulation during the resize handler
|
||||||
|
// because it is fired very often.
|
||||||
|
// Resizing is therefore performed 100 ms after the resize event stops.
|
||||||
|
clearTimeout(resizeTimer);
|
||||||
|
resizeTimer = setTimeout(function() {
|
||||||
|
resizeViewportElements();
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
|
||||||
// Resize viewport elements
|
// Resize viewport elements
|
||||||
resizeViewportElements = function() {
|
resizeViewportElements = function() {
|
||||||
viewportResizeTimer = setTimeout(function() {
|
viewportResizeTimer = setTimeout(function() {
|
||||||
@ -72,7 +72,10 @@ toolManager = {
|
|||||||
mouse: cornerstoneTools.arrowAnnotate,
|
mouse: cornerstoneTools.arrowAnnotate,
|
||||||
touch: cornerstoneTools.arrowAnnotateTouch
|
touch: cornerstoneTools.arrowAnnotateTouch
|
||||||
});
|
});
|
||||||
activeTool = OHIF.viewer.defaultTool;
|
|
||||||
|
if (OHIF.viewer.defaultTool) {
|
||||||
|
activeTool = OHIF.viewer.defaultTool;
|
||||||
|
}
|
||||||
|
|
||||||
configureTools();
|
configureTools();
|
||||||
initialized = true;
|
initialized = true;
|
||||||
|
|||||||
@ -121,10 +121,12 @@ Package.onUse(function (api) {
|
|||||||
api.addFiles('lib/enableHotkeys.js', 'client');
|
api.addFiles('lib/enableHotkeys.js', 'client');
|
||||||
api.addFiles('lib/viewportFunctions.js', 'client');
|
api.addFiles('lib/viewportFunctions.js', 'client');
|
||||||
api.addFiles('lib/WLPresets.js', 'client');
|
api.addFiles('lib/WLPresets.js', 'client');
|
||||||
|
api.addFiles('lib/resizeViewportElements.js', 'client');
|
||||||
api.addFiles('lib/encodeQueryData.js', 'server');
|
api.addFiles('lib/encodeQueryData.js', 'server');
|
||||||
|
|
||||||
//api.export('accountsConfig', 'client');
|
//api.export('accountsConfig', 'client');
|
||||||
|
api.export('resizeViewportElements','client');
|
||||||
|
api.export('handleResize','client');
|
||||||
api.export('enableHotkeys', 'client');
|
api.export('enableHotkeys', 'client');
|
||||||
api.export('enablePrefetchOnElement', 'client');
|
api.export('enablePrefetchOnElement', 'client');
|
||||||
api.export('displayReferenceLines', 'client');
|
api.export('displayReferenceLines', 'client');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user