Skip to content

Commit a0a0c23

Browse files
apply tablet design for curve
1 parent dda1904 commit a0a0c23

21 files changed

+696
-75
lines changed

frontend/javascripts/app/controllers/amplification_chart_ctrl.js.coffee

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,4 +929,15 @@ window.ChaiBioTech.ngApp.controller 'AmplificationChartCtrl', [
929929
last_target_channel = 0
930930
last_target_assigned = 0
931931

932+
$scope.onChangeScrollView = (direction, event) ->
933+
if event and (angular.element(event.target).hasClass('switch-item') or angular.element(event.target).hasClass('view-mode-switch'))
934+
return
935+
936+
if document.querySelector('.chart-screens-container').scrollLeft < 100
937+
if direction == '' or direction == 'right'
938+
angular.element(document.querySelector('.chart-screens-container')).animate { scrollLeft: 2500 }, 'fast'
939+
else
940+
angular.element(document.querySelector('.chart-screens-container')).animate { scrollLeft: 0 }, 'fast'
941+
return
942+
932943
]

frontend/javascripts/app/controllers/melt_curve_ctrl.coffee

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,4 +614,12 @@ App.controller 'MeltCurveChartCtrl', [
614614
$scope.label_Temp = ''
615615
$scope.label_Norm = ''
616616
$scope.label_dF_dT = ''
617+
618+
$scope.onChangeScrollView = (direction) ->
619+
if document.querySelector('.chart-screens-container').scrollLeft < 100
620+
if direction == '' or direction == 'right'
621+
angular.element(document.querySelector('.chart-screens-container')).animate { scrollLeft: 2500 }, 'fast'
622+
else
623+
angular.element(document.querySelector('.chart-screens-container')).animate { scrollLeft: 0 }, 'fast'
624+
return
617625
]

frontend/javascripts/app/controllers/standard_curve_chart_ctrl.js.coffee

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,4 +717,12 @@ window.ChaiBioTech.ngApp.controller 'StandardCurveChartCtrl', [
717717
$scope.targetGridTop = ->
718718
Math.max(document.getElementById("curve-plot").clientHeight + 30, 412 + 30)
719719

720+
$scope.onChangeScrollView = (direction) ->
721+
if document.querySelector('.chart-screens-container').scrollLeft < 100
722+
if direction == '' or direction == 'right'
723+
angular.element(document.querySelector('.chart-screens-container')).animate { scrollLeft: 2500 }, 'fast'
724+
else
725+
angular.element(document.querySelector('.chart-screens-container')).animate { scrollLeft: 0 }, 'fast'
726+
return
727+
720728
]

frontend/javascripts/app/directives/aspect-Ratio.coffee

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ App.directive 'aspectRatio', [
1818
offsetTop: '=?'
1919
link: ($scope, elem) ->
2020

21-
elem.addClass 'aspect-Ratio'
21+
elem.addClass 'aspect-Ratio'
2222

2323
getWidth = ->
24+
2425
# console.log('parent_getWidth')
2526
# console.log(elem.parent().width())
2627
width = elem.parent().width() - $scope.offsetX
@@ -45,13 +46,10 @@ App.directive 'aspectRatio', [
4546
# if height > elem.parent().height() then height = elem.parent().height()
4647
height
4748

48-
resizeAspectRatio = ->
49-
49+
resizeDesktopAspectRatio = ->
5050
width = getWidth()
5151
height = getHeight()
5252

53-
# console.log('resizeAspectRatio')
54-
5553
if width > $scope.maxWidth and height > $scope.maxHeight
5654
width = $scope.maxWidth
5755
height = $scope.maxHeight
@@ -69,7 +67,10 @@ App.directive 'aspectRatio', [
6967
elem.css('min-Width': width)
7068
elem.css('width': width)
7169
elem.css('min-height': height)
72-
elem.css('height': height)
70+
elem.css('height': height)
71+
angular.element('.choose-chart').removeClass('small')
72+
angular.element('.chart-screen-wapper').css('min-width': 1368)
73+
7374
elem.parent().children().last().get(0).style.height = height + "px"
7475
angular.element(elem.parent().children().last().get(0)).children().last().get(0).style.height = height - $scope.offsetTop + "px"
7576

@@ -81,6 +82,62 @@ App.directive 'aspectRatio', [
8182
element.getElementsByClassName('target-box')[0].style.padding = "5px 20px 5px 10px"
8283
else if offsetHeight == scrollHeight
8384
element.getElementsByClassName('target-box')[0].style.padding = "5px 10px"
85+
return
86+
87+
resizeTabletAspectRatio = ->
88+
innerHeight = window.innerHeight
89+
innerWidth = window.innerWidth
90+
91+
92+
minHeight = if innerWidth > 1024 then 780 else 640
93+
maxHeight = if innerWidth > 768 then 1024 else 720
94+
paddingHeight = 60
95+
96+
if innerWidth > 1112
97+
minHeight = 960
98+
maxHeight = 1024
99+
wellTableHeight = 175
100+
else if innerWidth > 1024
101+
minHeight = 720
102+
maxHeight = 1024
103+
wellTableHeight = 130
104+
paddingHeight = 40
105+
else if innerWidth > 992
106+
minHeight = 640
107+
maxHeight = 1024
108+
wellTableHeight = 110
109+
paddingHeight = 40
110+
else
111+
minHeight = 840
112+
maxHeight = 1024
113+
wellTableHeight = 110
114+
paddingHeight = 40
115+
116+
height = Math.min(Math.max(innerHeight, minHeight), maxHeight) - 100 - 100 - 60 - paddingHeight - wellTableHeight
117+
width = height * 1.7
118+
119+
elem.css('min-Width': width)
120+
elem.css('width': width)
121+
elem.css('min-height': height)
122+
elem.css('height': height)
123+
124+
if wellTableHeight == 175
125+
angular.element('.choose-chart').removeClass('small')
126+
else
127+
angular.element('.choose-chart').addClass('small')
128+
129+
angular.element('.chart-screen-wapper').css('min-width': width + 40 + 620)
130+
131+
return
132+
133+
resizeAspectRatio = ->
134+
innerWidth = window.innerWidth
135+
if innerWidth > 1366
136+
resizeDesktopAspectRatio()
137+
else
138+
resizeTabletAspectRatio()
139+
140+
84141

85142
resizeTimeout = null
86143

frontend/javascripts/app/directives/fixed-result-header.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ function fixedResultHeader($timeout, $window, $rootScope) {
130130
});
131131

132132
var validWidth = (tableMinWidth > parentWidth ? tableMinWidth : parentWidth - 3) - scrollWidth - fixedWidth;
133+
var innerWidth = window.innerWidth;
133134

134135
angular.forEach(elem.querySelectorAll('tr:first-child th'), function (thElem, i) {
135136
var tdElems = elem.querySelectorAll('tbody tr td:nth-child(' + (i + 1) + ')');
@@ -138,7 +139,15 @@ function fixedResultHeader($timeout, $window, $rootScope) {
138139

139140
angular.forEach(tdElems, function(tdElem, i){
140141
if(thElem.attributes.width.value.indexOf('%') != -1){
141-
tdElem.style.width = (widthPercent * validWidth / 100) + 'px';
142+
if(innerWidth > 1368){
143+
tdElem.style.width = (widthPercent * validWidth / 100) + 'px';
144+
} else {
145+
if(widthPercent == '100'){
146+
tdElem.style.width = '120px';
147+
} else {
148+
tdElem.style.width = (widthPercent * validWidth / 100) + 'px';
149+
}
150+
}
142151
// tdElem.style.width = widthPercent + '%';
143152
} else {
144153
tdElem.style.width = thElem.attributes.width.value;
@@ -147,8 +156,15 @@ function fixedResultHeader($timeout, $window, $rootScope) {
147156

148157
if (thElem) {
149158
if(thElem.attributes.width.value.indexOf('%') != -1){
150-
// thElem.style.width = widthPercent + '%';
151-
thElem.style.width = (widthPercent * validWidth / 100) + 'px';
159+
if(innerWidth > 1368){
160+
thElem.style.width = (widthPercent * validWidth / 100) + 'px';
161+
} else {
162+
if(widthPercent == '100'){
163+
thElem.style.width = '120px';
164+
} else {
165+
thElem.style.width = (widthPercent * validWidth / 100) + 'px';
166+
}
167+
}
152168
} else {
153169
thElem.style.width = thElem.attributes.width.value;
154170
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
App.directive 'fullViewHeight', [
2+
'WindowWrapper'
3+
'$timeout'
4+
(WindowWrapper, $timeout) ->
5+
6+
restrict: 'AE',
7+
scope:
8+
offset: '=?'
9+
force: '=?'
10+
doc: '=?'
11+
parent: '=?'
12+
min: '=?'
13+
link: ($scope, elem) ->
14+
15+
$scope.offset = ($scope.offset || 0) * 1
16+
$scope.min = ($scope.min || 0) * 1
17+
18+
elem.addClass 'full-height'
19+
getHeight = ->
20+
height = if $scope.doc
21+
WindowWrapper.documentHeight() - $scope.offset
22+
else if $scope.parent
23+
elem.parent().height() - $scope.offset
24+
else
25+
WindowWrapper.height() - $scope.offset
26+
27+
if height > elem.parent().height() then height = elem.parent().height()
28+
height = if $scope.min > height then $scope.min else height
29+
height
30+
31+
set = (height) ->
32+
height = height || getHeight()
33+
34+
if ($scope.force)
35+
elem.css( 'height': height )
36+
elem.css( 'min-height' : height )
37+
else
38+
# height = if elem.height() > height then elem.height() else height
39+
elem.css( 'min-height' : height )
40+
41+
resizeTimeout = null
42+
43+
$scope.$on 'window:resize', ->
44+
height = getHeight()
45+
elem.css('min-height': height, height: '', overflow: 'hidden')
46+
if resizeTimeout
47+
$timeout.cancel(resizeTimeout)
48+
49+
resizeTimeout = $timeout ->
50+
elem.css(overflow: '', height: '', 'min-height': '')
51+
set()
52+
resizeTimeout = null
53+
, 100
54+
55+
if $scope.min > 0
56+
set($scope.min)
57+
58+
$timeout(set, 100)
59+
60+
]

frontend/javascripts/app/directives/v2/amplification_well_switch.js.coffee

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ window.ChaiBioTech.ngApp.directive 'chartWellSwitch', [
5353
standard: '/images/ring_s.svg'
5454
unknown: '/images/ring_u.svg'
5555

56-
$scope.touch_desc = 'touch test'
57-
58-
5956
$scope.registerOutsideHover = false;
6057
unhighlight_event = ''
6158

@@ -98,14 +95,17 @@ window.ChaiBioTech.ngApp.directive 'chartWellSwitch', [
9895
ngModel.$setViewValue wells
9996
$scope.wells = wells
10097

101-
$scope.row_header_width = 20
98+
$scope.row_header_width = if window.innerWidth <= 1366 and window.innerWidth > 1112 then 30 else 20
10299
$scope.columns = []
103100
$scope.rows = []
104101
for i in [0...8]
105102
$scope.columns.push index: i, selected: false
106103
for i in [0...2]
107104
$scope.rows.push index: i, selected: false
108105

106+
$scope.$on 'window:resize', ->
107+
$scope.row_header_width = if window.innerWidth <= 1366 and window.innerWidth > 1112 then 30 else 20
108+
109109
$scope.getWidth = -> elem[0].parentElement.offsetWidth
110110
$scope.getCellWidth = ->
111111
($scope.getWidth() - $scope.row_header_width) / $scope.columns.length
@@ -248,9 +248,6 @@ window.ChaiBioTech.ngApp.directive 'chartWellSwitch', [
248248
# type can be 'column', 'row', 'well' or 'corner'
249249
# index is index of the type
250250

251-
$scope.touch_desc = $scope.touch_desc + '** touchStart **' + evt + ' ' + type + ' ' + index
252-
253-
254251
$scope.dragging = true
255252
$scope.dragStartingPoint =
256253
type: type
@@ -536,14 +533,19 @@ window.ChaiBioTech.ngApp.directive 'chartWellSwitch', [
536533

537534
if type is 'well' and index is $scope.dragStartingPoint.index
538535
# deselect all other wells if ctrl/cmd key is not held
539-
if !isCtrlKeyHeld(evt)
536+
# toggle selected state
537+
selected_count = 0
538+
for i in [0..15] by 1
539+
if $scope.wells["well_#{i}"].selected
540+
selected_count = selected_count + 1
541+
542+
if selected_count == 1
540543
$scope.rows.forEach (r) ->
541544
$scope.columns.forEach (c) ->
542545
$scope.wells["well_#{r.index * $scope.columns.length + c.index}"].selected = false
543546

544-
# toggle selected state
545547
well = $scope.wells["well_#{index}"]
546-
well.selected = if isCtrlKeyHeld(evt) then !well.selected else true
548+
well.selected = if selected_count > 1 then !well.selected else true
547549

548550

549551
if $scope.dragStartingPoint.type is 'well' and $scope.shiftStartIndex >= 0

frontend/javascripts/app/views/directives/v2/chart-well-switch.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
See the License for the specific language governing permissions and
1717
limitations under the License.
1818
-->
19-
<div class="chart-well-switch" style="height: 100%; display: block;">
19+
<div class="chart-well-switch" style="height: 100%; display: block;">
2020
<table style="height: 100%">
2121
<tbody>
2222
<tr>
23-
<th style="height:20px;" class="col-header G2" ng-click="selectAllWells()" ng-style="{width: row_header_width + 'px'}"></th>
24-
<th style="height:20px;" class="col-header G2" ng-class="{dragged: col.selected}" ng-mousedown="dragStart($event, 'column', col.index)" ng-mouseup="dragStop($event, 'column', col.index)" ng-mousemove="dragged($event, 'column', col.index)" ng-repeat="col in columns" ng-style="{width: getCellWidth() + 'px'}">
23+
<th class="col-header G2" ng-click="selectAllWells()" ng-style="{width: row_header_width + 'px'}"></th>
24+
<th class="col-header G2" ng-class="{dragged: col.selected}" ng-mousedown="dragStart($event, 'column', col.index)" ng-mouseup="dragStop($event, 'column', col.index)" ng-mousemove="dragged($event, 'column', col.index)" ng-repeat="col in columns" ng-style="{width: getCellWidth() + 'px'}">
2525
{{col.index + 1}}
2626
</th>
2727
</tr>

0 commit comments

Comments
 (0)