Grab and resize lesion table height

This commit is contained in:
Evren Ozkan 2015-12-07 11:55:48 -05:00
parent 3caab55b44
commit 884cbf06fe
3 changed files with 85 additions and 13 deletions

View File

@ -1,5 +1,7 @@
<template name="lesionTable"> <template name="lesionTable">
<div id="lesionTableContainer"> <div id="lesionTableContainer">
<div id="dragbar"></div>
<div id="lesionTableWrapper">
<table class="table table-striped noselect lesionTable" id="tblLesion"> <table class="table table-striped noselect lesionTable" id="tblLesion">
<thead> <thead>
<tr> <tr>
@ -22,4 +24,6 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
</template> </template>

View File

@ -3,7 +3,7 @@
* *
* @param measurementId The unique key for a specific Measurement * @param measurementId The unique key for a specific Measurement
*/ */
function activateLesion(measurementId, templateData) { activateLesion = function(measurementId, templateData) {
// Find Measurement data for this lesion // Find Measurement data for this lesion
var measurementData = Measurements.findOne(measurementId); var measurementData = Measurements.findOne(measurementId);
@ -216,11 +216,61 @@ Template.lesionTable.events({
$(e.currentTarget).addClass("selectedRow").siblings().removeClass("selectedRow"); $(e.currentTarget).addClass("selectedRow").siblings().removeClass("selectedRow");
activateLesion(measurementId,template.data); activateLesion(measurementId,template.data);
},
'mousedown div#dragbar': function(e, template) {
var pY = e.pageY;
var draggableParent = $(e.currentTarget).parent();
var startHeight = draggableParent.height();
//e.preventDefault();
template.dragging.set(true);
$(document).on('mouseup', function(e) {
template.dragging.set(false);
console.log(e.pageY);
$(document).off('mouseup').off('mousemove');
});
$(document).on('mousemove', function(e) {
var topPosition = e.pageY - pY;
draggableParent.css({
top: topPosition,
height: startHeight - topPosition
});
var contentId = Session.get("activeContentId");
var viewportAndLesionTableHeight = $("#viewportAndLesionTable").height();
var newPercentageHeightofLesionTable = (startHeight - topPosition) / viewportAndLesionTableHeight * 100;
var newPercentageHeightofViewermain = 100 - newPercentageHeightofLesionTable;
$(".viewerMain").height(newPercentageHeightofViewermain+"%");
// Resize viewport
var elements = $('.imageViewerViewport');
elements.each(function(index) {
var element = this;
if (!element) {
return;
} }
cornerstone.resize(element, true);
});
});
}
});
Template.lesionTable.onCreated(function(){
this.dragging = new ReactiveVar(false);
// Bind document mouse events
// $(document).on('mousemove', dragbarMove);
});
Template.lesionTable.onDestroyed(function(){
}); });
// Track ViewerData to get active timepoints // Track ViewerData to get active timepoints
// Put a visual indicator(<) in timepoint header in lesion table for active timepoints // Put a visual indicator(<) in timepoint header in lesion table for active timepoints
// timepointLoaded property is used to put indicator for loaded timepoints in viewport
Tracker.autorun(function () { Tracker.autorun(function () {
var allViewerData = Session.get('ViewerData'); var allViewerData = Session.get('ViewerData');
var contentId = Session.get('activeContentId'); var contentId = Session.get('activeContentId');
@ -273,3 +323,4 @@ Tracker.autorun(function () {
}); });

View File

@ -1,12 +1,29 @@
#lesionTableContainer #lesionTableContainer
width: 100% width: 100%
height: 16% height: 16%
background-color: #000000
#dragbar
width: 100%
height: 3px
postion: absolute
top: 0
left: 0
right: 0
bottom: 0
background-color: #666666
cursor: col-resize
#lesionTableWrapper
position: relative position: relative
width: 100%
height: 100%
margin: 0 auto
.lesionTable .lesionTable
td, th td, th
border: 1px solid white border: 1px solid #FFFFFF
border-collapse: collapse border-collapse: collapse
width: 100px width: 100px
@ -32,7 +49,7 @@
th th
border-bottom-width: 0 border-bottom-width: 0
font-weight: normal font-weight: normal
color:white color: #FFFFFF
line-height: 15px line-height: 15px
text-align: center text-align: center
margin: 0 margin: 0
@ -53,7 +70,7 @@
tr.selectedRow tr.selectedRow
background: #F5F5F5 !important background: #F5F5F5 !important
color: black !important color: #000000 !important
tr.lesionTableRow tr.lesionTableRow
width: 100% width: 100%