Added hotkey support to viewerbase

This commit is contained in:
Erik Ziegler committed 2015-12-09 15:48:24 +01:00
1 parent a005e5b359
commit da3101be93
59 files changed
+1002 -71

No files matched your search

@@ -0,0 +1,9 @@
<template name="playClipButton">
<button id="playClip" type="button" class="imageViewerCommand btn btn-sm btn-default" data-container="body" data-toggle="tooltip" data-placement="bottom" title="Play/Stop Clip">
{{ #if isPlaying }}
<span class="fa fa-stop"></span>
{{ else }}
<span class="fa fa-play"></span>
{{ /if }}
</button>
</template>
@@ -0,0 +1,34 @@
toggleCinePlay = function(element) {
if (!element) {
var activeViewport = Session.get('activeViewport');
element = $('.imageViewerViewport').get(activeViewport);
}
if (!element) {
return;
}
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());
};
Template.playClipButton.helpers({
'isPlaying': function() {
Session.get('UpdateCINE');
var activeViewport = Session.get('activeViewport');
return !!OHIF.viewer.isPlaying[activeViewport];
}
});
Template.playClipButton.events({
'click #playClip': function() {
toggleCinePlay();
}
});