Blocking negative values for CINE tool
This commit is contained in:
parent
dd26196cb5
commit
67fa502930
@ -1,69 +1,88 @@
|
|||||||
import { OHIF } from 'meteor/ohif:core';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
function updateFramerate(rate) {
|
Template.cineDialog.onCreated(() => {
|
||||||
OHIF.viewer.cine.framesPerSecond = rate;
|
const instance = Template.instance();
|
||||||
|
|
||||||
// Update playClip toolData for this imageId
|
instance.updateFramerate = rate => {
|
||||||
var element = getActiveViewportElement();
|
OHIF.viewer.cine.framesPerSecond = rate;
|
||||||
var playClipToolData = cornerstoneTools.getToolState(element, 'playClip');
|
|
||||||
playClipToolData.data[0].framesPerSecond = OHIF.viewer.cine.framesPerSecond;
|
|
||||||
|
|
||||||
// If the movie is playing, stop/start to update the framerate
|
// Update playClip toolData for this imageId
|
||||||
if (isPlaying()) {
|
|
||||||
cornerstoneTools.stopClip(element);
|
|
||||||
cornerstoneTools.playClip(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
Session.set('UpdateCine', Random.id());
|
|
||||||
}
|
|
||||||
|
|
||||||
Template.cineDialog.helpers({
|
|
||||||
isPlaying: function() {
|
|
||||||
return isPlaying();
|
|
||||||
},
|
|
||||||
framerate: function() {
|
|
||||||
Session.get('UpdateCine');
|
|
||||||
return OHIF.viewer.cine.framesPerSecond.toFixed(1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.cineDialog.events({
|
|
||||||
'click #cineFirstButton': function() {
|
|
||||||
switchToImageByIndex(0);
|
|
||||||
},
|
|
||||||
'click #cineBackButton': function() {
|
|
||||||
switchToImageRelative(-1);
|
|
||||||
},
|
|
||||||
'click #cineSlowPlaybackButton': function() {
|
|
||||||
updateFramerate(OHIF.viewer.cine.framesPerSecond - 1);
|
|
||||||
},
|
|
||||||
'click #cinePlayButton': function() {
|
|
||||||
toggleCinePlay();
|
|
||||||
},
|
|
||||||
'click #cineNextButton': function() {
|
|
||||||
switchToImageRelative(1);
|
|
||||||
},
|
|
||||||
'click #cineFastForwardButton': function() {
|
|
||||||
updateFramerate(OHIF.viewer.cine.framesPerSecond + 1);
|
|
||||||
},
|
|
||||||
'click #cineLastButton': function() {
|
|
||||||
switchToImageByIndex(-1);
|
|
||||||
},
|
|
||||||
'change #cineLoopCheckbox': function(e) {
|
|
||||||
var element = getActiveViewportElement();
|
var element = getActiveViewportElement();
|
||||||
var playClipToolData = cornerstoneTools.getToolState(element, 'playClip');
|
var playClipToolData = cornerstoneTools.getToolState(element, 'playClip');
|
||||||
playClipToolData.data[0].loop = $(e.currentTarget).is(':checked');
|
playClipToolData.data[0].framesPerSecond = OHIF.viewer.cine.framesPerSecond;
|
||||||
OHIF.viewer.cine.loop = playClipToolData.data[0].loop;
|
|
||||||
},
|
// If the movie is playing, stop/start to update the framerate
|
||||||
'input #cineSlider': function(e) {
|
if (isPlaying()) {
|
||||||
// Update the FPS text onscreen
|
cornerstoneTools.stopClip(element);
|
||||||
var rate = parseFloat($(e.currentTarget).val());
|
cornerstoneTools.playClip(element);
|
||||||
updateFramerate(rate);
|
}
|
||||||
}
|
|
||||||
|
Session.set('UpdateCine', Random.id());
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.cineDialog.onRendered(function() {
|
Template.cineDialog.onRendered(() => {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
const dialog = instance.$('#cineDialog');
|
const dialog = instance.$('#cineDialog');
|
||||||
dialog.draggable();
|
dialog.draggable();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Template.cineDialog.events({
|
||||||
|
'click #cineFirstButton'(event, instance) {
|
||||||
|
switchToImageByIndex(0);
|
||||||
|
},
|
||||||
|
|
||||||
|
'click #cineBackButton'(event, instance) {
|
||||||
|
switchToImageRelative(-1);
|
||||||
|
},
|
||||||
|
|
||||||
|
'click #cineSlowPlaybackButton'(event, instance) {
|
||||||
|
const newValue = OHIF.viewer.cine.framesPerSecond - 1;
|
||||||
|
if (newValue > 0) {
|
||||||
|
instance.updateFramerate(newValue);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'click #cinePlayButton'(event, instance) {
|
||||||
|
toggleCinePlay();
|
||||||
|
},
|
||||||
|
|
||||||
|
'click #cineNextButton'(event, instance) {
|
||||||
|
switchToImageRelative(1);
|
||||||
|
},
|
||||||
|
|
||||||
|
'click #cineFastForwardButton'(event, instance) {
|
||||||
|
const newValue = OHIF.viewer.cine.framesPerSecond + 1;
|
||||||
|
if (newValue <= 90) {
|
||||||
|
instance.updateFramerate(newValue);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'click #cineLastButton'(event, instance) {
|
||||||
|
switchToImageByIndex(-1);
|
||||||
|
},
|
||||||
|
|
||||||
|
'change #cineLoopCheckbox'(event, instance) {
|
||||||
|
var element = getActiveViewportElement();
|
||||||
|
var playClipToolData = cornerstoneTools.getToolState(element, 'playClip');
|
||||||
|
playClipToolData.data[0].loop = $(event.currentTarget).is(':checked');
|
||||||
|
OHIF.viewer.cine.loop = playClipToolData.data[0].loop;
|
||||||
|
},
|
||||||
|
|
||||||
|
'input #cineSlider'(event, instance) {
|
||||||
|
// Update the FPS text onscreen
|
||||||
|
var rate = parseFloat($(event.currentTarget).val());
|
||||||
|
instance.updateFramerate(rate);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.cineDialog.helpers({
|
||||||
|
isPlaying() {
|
||||||
|
return isPlaying();
|
||||||
|
},
|
||||||
|
|
||||||
|
framerate() {
|
||||||
|
Session.get('UpdateCine');
|
||||||
|
return OHIF.viewer.cine.framesPerSecond.toFixed(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user