[web] fix virtual scroll range

This commit is contained in:
Jason 2016-03-12 23:04:31 +08:00
parent 4a6edd92e6
commit ae61025d5d
2 changed files with 5 additions and 3 deletions

View File

@ -2873,6 +2873,8 @@ var _react = require("react");
var _react2 = _interopRequireDefault(_react);
var _common = require("./common.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
Footer.propTypes = {
@ -2902,7 +2904,7 @@ function Footer(_ref) {
);
}
},{"react":"react"}],15:[function(require,module,exports){
},{"./common.js":4,"react":"react"}],15:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@ -3505,7 +3507,7 @@ function calcVScroll(opts) {
// Make sure that we start at an even row so that CSS `:nth-child(even)` is preserved
start = Math.max(0, Math.floor(viewportTop / rowHeight) - 1) & ~1;
end = Math.min(itemCount, start + Math.ceil(viewportHeight / rowHeight) + 1);
end = Math.min(itemCount, start + Math.ceil(viewportHeight / rowHeight) + 2);
// When a large trunk of elements is removed from the button, start may be far off the viewport.
// To make this issue less severe, limit the top placeholder to the total number of rows.

View File

@ -57,7 +57,7 @@ export function calcVScroll(opts) {
start = Math.max(0, Math.floor(viewportTop / rowHeight) - 1) & ~1;
end = Math.min(
itemCount,
start + Math.ceil(viewportHeight / rowHeight) + 1
start + Math.ceil(viewportHeight / rowHeight) + 2
);
// When a large trunk of elements is removed from the button, start may be far off the viewport.