|
23 | 23 | compile: function() { |
24 | 24 | return { |
25 | 25 | pre: function prelink($scope, $elm, $attrs, controllers) { |
26 | | - var rowContainer, colContainer, gridContainerPrefix, |
| 26 | + var rowContainer, colContainer, |
27 | 27 | uiGridCtrl = controllers[0], |
28 | 28 | containerCtrl = controllers[1], |
29 | | - grid = $scope.grid = uiGridCtrl.grid, |
30 | | - gridContainerId = 'grid-container'; |
| 29 | + grid = $scope.grid = uiGridCtrl.grid; |
31 | 30 |
|
32 | 31 | // Verify that the render container for this element exists |
33 | 32 | if (!$scope.rowContainerName) { |
|
46 | 45 |
|
47 | 46 | rowContainer = $scope.rowContainer = grid.renderContainers[$scope.rowContainerName]; |
48 | 47 | colContainer = $scope.colContainer = grid.renderContainers[$scope.colContainerName]; |
49 | | - gridContainerPrefix = $scope.containerId !== 'body' ? $scope.containerId + '-' : ''; |
50 | 48 |
|
51 | | - containerCtrl.gridContainerId = gridContainerPrefix + gridContainerId; |
52 | 49 | containerCtrl.containerId = $scope.containerId; |
53 | 50 | containerCtrl.rowContainer = rowContainer; |
54 | 51 | containerCtrl.colContainer = colContainer; |
55 | | - containerCtrl.grid = grid; |
56 | 52 | }, |
57 | 53 | post: function postlink($scope, $elm, $attrs, controllers) { |
58 | 54 | var uiGridCtrl = controllers[0], |
|
70 | 66 | // Scroll the render container viewport when the mousewheel is used |
71 | 67 | gridUtil.on.mousewheel($elm, function(event) { |
72 | 68 | var scrollEvent = new ScrollEvent(grid, rowContainer, colContainer, ScrollEvent.Sources.RenderContainerMouseWheel); |
| 69 | + |
73 | 70 | if (event.deltaY !== 0) { |
74 | 71 | var scrollYAmount = event.deltaY * -1 * event.deltaFactor; |
75 | 72 |
|
|
107 | 104 | } |
108 | 105 |
|
109 | 106 | // Let the parent container scroll if the grid is already at the top/bottom |
110 | | - if ((event.deltaY !== 0 && (scrollEvent.atTop(scrollTop) || scrollEvent.atBottom(scrollTop))) || |
111 | | - (event.deltaX !== 0 && (scrollEvent.atLeft(scrollLeft) || scrollEvent.atRight(scrollLeft)))) { |
112 | | - // parent controller scrolls |
113 | | - } |
114 | | - else { |
| 107 | + if (!((event.deltaY !== 0 && (scrollEvent.atTop(scrollTop) || scrollEvent.atBottom(scrollTop))) || |
| 108 | + (event.deltaX !== 0 && (scrollEvent.atLeft(scrollLeft) || scrollEvent.atRight(scrollLeft))))) { |
115 | 109 | event.preventDefault(); |
116 | 110 | event.stopPropagation(); |
117 | 111 | scrollEvent.fireThrottledScrollingEvent('', scrollEvent); |
118 | 112 | } |
119 | | - |
120 | 113 | }); |
121 | 114 |
|
122 | 115 | $elm.bind('$destroy', function() { |
123 | | - var eventsToUnbind = ['touchstart', 'touchmove', 'touchend', 'keydown', 'wheel', 'mousewheel', |
124 | | - 'DomMouseScroll', 'MozMousePixelScroll']; |
| 116 | + $elm.unbind('keydown'); |
125 | 117 |
|
126 | | - eventsToUnbind.forEach(function(eventName) { |
| 118 | + ['touchstart', 'touchmove', 'touchend', 'keydown', 'wheel', 'mousewheel', |
| 119 | + 'DomMouseScroll', 'MozMousePixelScroll'].forEach(function(eventName) { |
127 | 120 | $elm.unbind(eventName); |
128 | 121 | }); |
129 | 122 | }); |
|
137 | 130 |
|
138 | 131 | var canvasHeight = rowContainer.getCanvasHeight(); |
139 | 132 |
|
140 | | - // add additional height for scrollbar on left and right container |
141 | | - // if ($scope.containerId !== 'body') { |
142 | | - // canvasHeight -= grid.scrollbarHeight; |
143 | | - // } |
144 | | - |
145 | 133 | var viewportHeight = rowContainer.getViewportHeight(); |
146 | 134 | // shorten the height to make room for a scrollbar placeholder |
147 | 135 | if (colContainer.needsHScrollbarPlaceholder()) { |
|
0 commit comments