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';
|
||||
|
||||
function updateFramerate(rate) {
|
||||
OHIF.viewer.cine.framesPerSecond = rate;
|
||||
Template.cineDialog.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
// Update playClip toolData for this imageId
|
||||
var element = getActiveViewportElement();
|
||||
var playClipToolData = cornerstoneTools.getToolState(element, 'playClip');
|
||||
playClipToolData.data[0].framesPerSecond = OHIF.viewer.cine.framesPerSecond;
|
||||
instance.updateFramerate = rate => {
|
||||
OHIF.viewer.cine.framesPerSecond = rate;
|
||||
|
||||
// If the movie is playing, stop/start to update the framerate
|
||||
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) {
|
||||
// Update playClip toolData for this imageId
|
||||
var element = getActiveViewportElement();
|
||||
var playClipToolData = cornerstoneTools.getToolState(element, 'playClip');
|
||||
playClipToolData.data[0].loop = $(e.currentTarget).is(':checked');
|
||||
OHIF.viewer.cine.loop = playClipToolData.data[0].loop;
|
||||
},
|
||||
'input #cineSlider': function(e) {
|
||||
// Update the FPS text onscreen
|
||||
var rate = parseFloat($(e.currentTarget).val());
|
||||
updateFramerate(rate);
|
||||
}
|
||||
playClipToolData.data[0].framesPerSecond = OHIF.viewer.cine.framesPerSecond;
|
||||
|
||||
// If the movie is playing, stop/start to update the framerate
|
||||
if (isPlaying()) {
|
||||
cornerstoneTools.stopClip(element);
|
||||
cornerstoneTools.playClip(element);
|
||||
}
|
||||
|
||||
Session.set('UpdateCine', Random.id());
|
||||
};
|
||||
});
|
||||
|
||||
Template.cineDialog.onRendered(function() {
|
||||
Template.cineDialog.onRendered(() => {
|
||||
const instance = Template.instance();
|
||||
const dialog = instance.$('#cineDialog');
|
||||
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