2015-12-09 14:24:40 +01:00
|
|
|
toggleCinePlay = function(element) {
|
2015-12-09 15:48:24 +01:00
|
|
|
if (!element) {
|
|
|
|
|
var activeViewport = Session.get('activeViewport');
|
|
|
|
|
element = $('.imageViewerViewport').get(activeViewport);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!element) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-09 14:24:40 +01:00
|
|
|
var viewportIndex = $('.imageViewerViewport').index(element);
|
|
|
|
|
var isPlaying = OHIF.viewer.isPlaying[viewportIndex] || false;
|
|
|
|
|
if (isPlaying === true) {
|
|
|
|
|
cornerstoneTools.stopClip(element);
|
|
|
|
|
} else {
|
|
|
|
|
cornerstoneTools.playClip(element);
|
|
|
|
|
}
|
|
|
|
|
OHIF.viewer.isPlaying[viewportIndex] = !OHIF.viewer.isPlaying[viewportIndex];
|
|
|
|
|
Session.set('UpdateCINE', Random.id());
|
|
|
|
|
};
|
|
|
|
|
|
2015-10-15 15:05:41 +02:00
|
|
|
Template.playClipButton.helpers({
|
|
|
|
|
'isPlaying': function() {
|
|
|
|
|
Session.get('UpdateCINE');
|
2015-10-30 12:21:59 +01:00
|
|
|
var activeViewport = Session.get('activeViewport');
|
2015-12-15 16:20:57 +01:00
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
}
|
2015-10-30 12:21:59 +01:00
|
|
|
return !!OHIF.viewer.isPlaying[activeViewport];
|
2015-10-15 15:05:41 +02:00
|
|
|
}
|
2015-12-09 14:24:40 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.playClipButton.events({
|
|
|
|
|
'click #playClip': function() {
|
2015-12-09 15:48:24 +01:00
|
|
|
toggleCinePlay();
|
2015-12-09 14:24:40 +01:00
|
|
|
}
|
2015-10-15 15:05:41 +02:00
|
|
|
});
|