-
Notifications
You must be signed in to change notification settings - Fork 106
Fixed row height optimization #221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: fixed-height-optimization
Are you sure you want to change the base?
Changes from 1 commit
61cb0cc
bedd378
71c2f33
8f4bece
551bff3
43561dd
d183273
62c8bc6
fdcca3d
b1be940
45a8387
95a6d4a
359d905
b174ffc
0b62060
bbc1a74
dd3bdfc
3cff84e
07e7047
9c26d38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,9 @@ angular.module('ui.scroll', []) | |
// | ||
const rowHeight = parseNumericAttr($attr.rowHeight, null, false); | ||
|
||
// PHIL: Read the visibility watch option, true by default | ||
const allowVisibilityWatch = $attr.allowVisibilityWatch!=='false'; | ||
|
||
// Revision IDs | ||
// | ||
let ridActual = 0; // current data revision id | ||
|
@@ -259,7 +262,7 @@ angular.module('ui.scroll', []) | |
} | ||
|
||
function isElementVisible(wrapper) { | ||
return wrapper.element.height() && wrapper.element[0].offsetParent; | ||
return (rowHeight || wrapper.element.height()) && wrapper.element[0].offsetParent; | ||
} | ||
|
||
function visibilityWatcher(wrapper) { | ||
|
@@ -278,10 +281,10 @@ angular.module('ui.scroll', []) | |
|
||
function insertWrapperContent(wrapper, insertAfter) { | ||
createElement(wrapper, insertAfter, viewport.insertElement); | ||
if (!rowHeight && !isElementVisible(wrapper)) { | ||
if (allowVisibilityWatch && !isElementVisible(wrapper)) { | ||
wrapper.unregisterVisibilityWatcher = wrapper.scope.$watch(() => visibilityWatcher(wrapper)); | ||
} | ||
if (!rowHeight) { | ||
if (allowVisibilityWatch) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This particular case, I mean hiding the elements before data binding, is not related to visibility-watcher. I would say that it may relate to rowHeight. We are hiding new rows before data binding, because the height might change after binding, and there could be some bad side effects (scroll bar shifting). And we may not hide new rows if we know that the height is not going to be changed. |
||
elementRoutines.hideElement(wrapper); // hide inserted elements before data binding | ||
} | ||
} | ||
|
@@ -397,7 +400,7 @@ angular.module('ui.scroll', []) | |
// We need the item bindings to be processed before we can do adjustments | ||
!$scope.$$phase && !$rootScope.$$phase && $scope.$digest(); | ||
|
||
|
||
if (!rowHeight) { | ||
if (allowVisibilityWatch) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Showing new rows after binding relates to hiding new rows before binding. So it does not relate to visibility-watcher, it may relate to rowHeight (see previous comment). |
||
updates.inserted.forEach(w => elementRoutines.showElement(w)); | ||
updates.prepended.forEach(w => elementRoutines.showElement(w)); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switched to camelcase, which means
row-height="20"
usage