|
2 | 2 | 'use strict';
|
3 | 3 |
|
4 | 4 | var module = angular.module('ui.grid');
|
5 |
| - |
| 5 | + |
6 | 6 | module.directive('uiGridRenderContainer', ['$timeout', '$document', 'uiGridConstants', 'gridUtil', 'ScrollEvent',
|
7 | 7 | function($timeout, $document, uiGridConstants, gridUtil, ScrollEvent) {
|
8 | 8 | return {
|
|
45 | 45 |
|
46 | 46 | var rowContainer = $scope.rowContainer = grid.renderContainers[$scope.rowContainerName];
|
47 | 47 | var colContainer = $scope.colContainer = grid.renderContainers[$scope.colContainerName];
|
48 |
| - |
| 48 | + |
49 | 49 | containerCtrl.containerId = $scope.containerId;
|
50 | 50 | containerCtrl.rowContainer = rowContainer;
|
51 | 51 | containerCtrl.colContainer = colContainer;
|
|
98 | 98 | }
|
99 | 99 |
|
100 | 100 | // Let the parent container scroll if the grid is already at the top/bottom
|
101 |
| - if (scrollEvent.atTop(scrollTop) || |
102 |
| - scrollEvent.atBottom(scrollTop) || |
103 |
| - scrollEvent.atLeft(scrollLeft) || |
104 |
| - scrollEvent.atRight(scrollLeft)) { |
| 101 | + if ((event.deltaY !== 0 && (scrollEvent.atTop(scrollTop) || scrollEvent.atBottom(scrollTop))) || |
| 102 | + (event.deltaX !== 0 && (scrollEvent.atLeft(scrollLeft) || scrollEvent.atRight(scrollLeft)))) { |
105 | 103 | //parent controller scrolls
|
106 | 104 | }
|
107 | 105 | else {
|
|
118 | 116 | $elm.unbind(eventName);
|
119 | 117 | });
|
120 | 118 | });
|
121 |
| - |
| 119 | + |
122 | 120 | // TODO(c0bra): Handle resizing the inner canvas based on the number of elements
|
123 | 121 | function update() {
|
124 | 122 | var ret = '';
|
|
137 | 135 |
|
138 | 136 | var headerViewportWidth = colContainer.getHeaderViewportWidth();
|
139 | 137 | var footerViewportWidth = colContainer.getHeaderViewportWidth();
|
140 |
| - |
| 138 | + |
141 | 139 | // Set canvas dimensions
|
142 | 140 | ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-canvas { width: ' + canvasWidth + 'px; height: ' + canvasHeight + 'px; }';
|
143 | 141 |
|
|
146 | 144 | if (renderContainer.explicitHeaderCanvasHeight) {
|
147 | 145 | ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-canvas { height: ' + renderContainer.explicitHeaderCanvasHeight + 'px; }';
|
148 | 146 | }
|
149 |
| - |
| 147 | + |
150 | 148 | ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-viewport { width: ' + viewportWidth + 'px; height: ' + viewportHeight + 'px; }';
|
151 | 149 | ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-viewport { width: ' + headerViewportWidth + 'px; }';
|
152 | 150 |
|
|
155 | 153 |
|
156 | 154 | return ret;
|
157 | 155 | }
|
158 |
| - |
| 156 | + |
159 | 157 | uiGridCtrl.grid.registerStyleComputation({
|
160 | 158 | priority: 6,
|
161 | 159 | func: update
|
|
168 | 166 | }]);
|
169 | 167 |
|
170 | 168 | module.controller('uiGridRenderContainer', ['$scope', 'gridUtil', function ($scope, gridUtil) {
|
171 |
| - |
| 169 | + |
172 | 170 | }]);
|
173 | 171 |
|
174 | 172 | })();
|
0 commit comments