Fixed bugs in standalone Viewer, recreated client-only build
This commit is contained in:
1 parent
739c6e9e9f
commit
da7202de0f
16 files changed
+194
-119
No files matched your search
+20
-1
@@ -205,6 +205,10 @@ Template.thumbnailEntry.onCreated(() => {
|
||||
instance.isDragAndDrop = _.isUndefined(instance.data.viewportIndex);
|
||||
});
|
||||
|
||||
Template.thumbnailEntry.onRendered(() => {
|
||||
console.warn('thumbnailEntry onRendered');
|
||||
});
|
||||
|
||||
Template.thumbnailEntry.events({
|
||||
// Event handlers for drag and drop
|
||||
'touchstart .thumbnailEntry, mousedown .thumbnailEntry'(event, instance) {
|
||||
@@ -250,6 +254,21 @@ Template.thumbnailEntry.helpers({
|
||||
return Template.instance().isDragAndDrop ? 'draggable' : '';
|
||||
},
|
||||
instanceNumber() {
|
||||
return Template.instance().data.thumbnail.stack.images[0].instanceNumber;
|
||||
const thumbnail = Template.instance().data.thumbnail;
|
||||
if (!thumbnail) {
|
||||
return;
|
||||
}
|
||||
|
||||
const stack = thumbnail.stack;
|
||||
if (!stack) {
|
||||
return;
|
||||
}
|
||||
|
||||
const firstImage = stack.images[0];
|
||||
if (!firstImage) {
|
||||
return;
|
||||
}
|
||||
|
||||
return firstImage.instanceNumber;
|
||||
}
|
||||
});
|
||||
@@ -35,6 +35,10 @@ Template.cineDialog.onCreated(() => {
|
||||
|
||||
// Update playClip toolData for this imageId
|
||||
const element = getActiveViewportElement();
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
const playClipToolData = cornerstoneTools.getToolState(element, 'playClip');
|
||||
playClipToolData.data[0].framesPerSecond = OHIF.viewer.cine.framesPerSecond;
|
||||
|
||||
@@ -77,6 +81,9 @@ Template.cineDialog.onCreated(() => {
|
||||
Tracker.afterFlush(() => {
|
||||
// Get the active viewportElement
|
||||
const element = getActiveViewportElement();
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the cornerstone playClip tool data
|
||||
const toolData = cornerstoneTools.getToolState(element, 'playClip').data[0];
|
||||
|
||||
+3
@@ -497,6 +497,9 @@ Template.imageViewerViewport.onDestroyed(function() {
|
||||
|
||||
// When a viewport element is being destroyed
|
||||
var element = this.find('.imageViewerViewport');
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to stop any currently playing clips
|
||||
// Otherwise the interval will continuously throw errors
|
||||
|
||||
@@ -20,5 +20,9 @@ applyWLPreset = function(presetName, element) {
|
||||
|
||||
applyWLPresetToActiveElement = function(presetName) {
|
||||
var element = getActiveViewportElement();
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
applyWLPreset(presetName, element);
|
||||
};
|
||||
@@ -8,6 +8,10 @@ getActiveViewportElement = () => {
|
||||
|
||||
zoomIn = () => {
|
||||
const element = getActiveViewportElement();
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
let viewport = cornerstone.getViewport(element);
|
||||
const scaleIncrement = 0.15;
|
||||
const maximumScale = 10;
|
||||
@@ -17,6 +21,10 @@ zoomIn = () => {
|
||||
|
||||
zoomOut = () => {
|
||||
const element = getActiveViewportElement();
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
let viewport = cornerstone.getViewport(element);
|
||||
const scaleIncrement = 0.15;
|
||||
const minimumScale = 0.05;
|
||||
@@ -26,11 +34,19 @@ zoomOut = () => {
|
||||
|
||||
zoomToFit = () => {
|
||||
const element = getActiveViewportElement();
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
cornerstone.fitToWindow(element);
|
||||
};
|
||||
|
||||
rotateL = () => {
|
||||
const element = getActiveViewportElement();
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
let viewport = cornerstone.getViewport(element);
|
||||
viewport.rotation -= 90;
|
||||
cornerstone.setViewport(element, viewport);
|
||||
@@ -39,6 +55,10 @@ rotateL = () => {
|
||||
|
||||
rotateR = () => {
|
||||
const element = getActiveViewportElement();
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
let viewport = cornerstone.getViewport(element);
|
||||
viewport.rotation += 90;
|
||||
cornerstone.setViewport(element, viewport);
|
||||
@@ -47,6 +67,10 @@ rotateR = () => {
|
||||
|
||||
invert = () => {
|
||||
const element = getActiveViewportElement();
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
let viewport = cornerstone.getViewport(element);
|
||||
viewport.invert = (viewport.invert === false);
|
||||
cornerstone.setViewport(element, viewport);
|
||||
@@ -121,6 +145,10 @@ isPlaying = () => {
|
||||
|
||||
// Get the viewport element and its current playClip tool state
|
||||
const element = getActiveViewportElement();
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
const toolState = cornerstoneTools.getToolState(element, 'playClip');
|
||||
|
||||
// Stop here if the tool state is not defined yet
|
||||
@@ -134,5 +162,6 @@ isPlaying = () => {
|
||||
// Return true if the clip is playing
|
||||
return !_.isUndefined(clipState.intervalId);
|
||||
};
|
||||
|
||||
// Create an event listener to update playing state when a clip stops playing
|
||||
$(window).on('CornerstoneToolsClipStopped', () => Session.set('UpdateCINE', Random.id()));
|
||||
Reference in new issue
Block a user