|
86 | 86 | var shrink = element.resizeSensor.childNodes[1];
|
87 | 87 | var shrinkChild = shrink.childNodes[0];
|
88 | 88 |
|
89 |
| - var lastWidth, lastHeight; |
| 89 | + var lastShrinkWidth, lastShrinkHeight; |
| 90 | + var lastExpandWidth, lastExpandHeight; |
90 | 91 |
|
91 | 92 | var reset = function() {
|
| 93 | + resetExpand(); |
| 94 | + resetShrink(); |
| 95 | + }; |
| 96 | + |
| 97 | + var resetExpand = function() { |
92 | 98 | expandChild.style.width = expand.offsetWidth + 10 + 'px';
|
93 | 99 | expandChild.style.height = expand.offsetHeight + 10 + 'px';
|
94 | 100 | expand.scrollLeft = expand.scrollWidth;
|
95 | 101 | expand.scrollTop = expand.scrollHeight;
|
| 102 | + lastExpandWidth = element.offsetWidth; |
| 103 | + lastExpandHeight = element.offsetHeight; |
| 104 | + }; |
| 105 | + |
| 106 | + var resetShrink = function() { |
96 | 107 | shrink.scrollLeft = shrink.scrollWidth;
|
97 | 108 | shrink.scrollTop = shrink.scrollHeight;
|
98 |
| - lastWidth = element.offsetWidth; |
99 |
| - lastHeight = element.offsetHeight; |
| 109 | + lastShrinkWidth = element.offsetWidth; |
| 110 | + lastShrinkHeight = element.offsetHeight; |
100 | 111 | };
|
101 | 112 |
|
102 | 113 | reset();
|
|
116 | 127 | };
|
117 | 128 |
|
118 | 129 | addEvent(expand, 'scroll', function() {
|
119 |
| - if (element.offsetWidth > lastWidth || element.offsetHeight > lastHeight) { |
| 130 | + if (element.offsetWidth > lastExpandWidth || element.offsetHeight > lastExpandHeight) { |
120 | 131 | changed();
|
121 | 132 | }
|
122 |
| - reset(); |
| 133 | + resetExpand(); |
123 | 134 | });
|
124 | 135 |
|
125 | 136 | addEvent(shrink, 'scroll',function() {
|
126 |
| - if (element.offsetWidth < lastWidth || element.offsetHeight < lastHeight) { |
| 137 | + if (element.offsetWidth < lastShrinkWidth || element.offsetHeight < lastShrinkHeight) { |
127 | 138 | changed();
|
128 | 139 | }
|
129 |
| - reset(); |
| 140 | + resetShrink(); |
130 | 141 | });
|
131 | 142 | }
|
132 | 143 |
|
|
0 commit comments