LT-150: Added isPanelPinned property in ViewerData session to check whether thumbnails panel of the active tab is pinned or not

This commit is contained in:
Aysel Afsar 2016-01-19 23:35:41 -05:00
parent 5c38c4ffd9
commit 2ceca2bd10

View File

@ -1,3 +1,25 @@
function pinPanel() {
var hidingPanel = $(".hidingPanel");
hidingPanel.css({
width: '122px'
});
hidingPanel.find('.hidingPanelContent').css({
transform: 'translate(130px)'
});
// Calculate newWidth of viewportAndLesionTable
var viewerWidth = $('#viewer').width();
var newWidth = 100 - 122 / viewerWidth * 100;
$("#viewportAndLesionTable").css('width', newWidth + '%');
}
function unpinPanel() {
// Calculate newWidth of viewportAndLesionTable
$("#viewportAndLesionTable").css('width', '99%');
}
Template.hidingPanel.events({
'mouseover div.hidingPanel': function(e, template) {
var isPinned = template.isPinned.get();
@ -52,15 +74,15 @@ Template.hidingPanel.events({
template.isPinned.set(isPinned);
var mainElements = $('#viewportAndLesionTable');
// Set isPanelPinned of ViewerData
var contentId = template.data.contentId;
ViewerData[contentId].isPanelPinned = isPinned;
Session.set('ViewerData', ViewerData);
if (isPinned) {
// Calculate newWidth of viewportAndLesionTable
var viewerWidth = $('#viewer').width();
var newWidth = 100 - 122 / viewerWidth * 100;
mainElements.css('width', newWidth + '%');
pinPanel();
} else {
// Calculate newWidth of viewportAndLesionTable
mainElements.css('width', '99%');
unpinPanel();
}
resizeViewportElements();
@ -76,7 +98,26 @@ Template.hidingPanel.helpers({
}
});
Template.hidingPanel.onCreated(function() {
this.panelOpen = new ReactiveVar(false);
this.isPinned = new ReactiveVar(false);
Template.hidingPanel.onRendered(function() {
var contentId = this.data.contentId;
var isPanelPinned = ViewerData[contentId].isPanelPinned;
if (isPanelPinned) {
pinPanel();
}
});
Template.hidingPanel.onCreated(function() {
this.panelOpen = new ReactiveVar(false);
var contentId = this.data.contentId;
var isPanelPinned = ViewerData[contentId].isPanelPinned;
if (!isPanelPinned) {
isPanelPinned = false;
}
this.isPinned = new ReactiveVar(isPanelPinned);
});