Scroll columns area to right when children property is changed (#4517)
The feature to pin column could hide the rightmost column, which is specified with children property of ColumnsArea. The user is likely to see the column when the property changed, so scroll the area in such cases.
This commit is contained in:
parent
400616813e
commit
9d1f8b9d6a
4 changed files with 20 additions and 9 deletions
|
@ -1,9 +1,9 @@
|
|||
const easingOutQuint = (x, t, b, c, d) => c * ((t = t / d - 1) * t * t * t * t + 1) + b;
|
||||
|
||||
const scrollTop = (node) => {
|
||||
const scroll = (node, key, target) => {
|
||||
const startTime = Date.now();
|
||||
const offset = node.scrollTop;
|
||||
const targetY = -offset;
|
||||
const offset = node[key];
|
||||
const gap = target - offset;
|
||||
const duration = 1000;
|
||||
let interrupt = false;
|
||||
|
||||
|
@ -15,7 +15,7 @@ const scrollTop = (node) => {
|
|||
return;
|
||||
}
|
||||
|
||||
node.scrollTop = easingOutQuint(0, elapsed, offset, targetY, duration);
|
||||
node[key] = easingOutQuint(0, elapsed, offset, gap, duration);
|
||||
requestAnimationFrame(step);
|
||||
};
|
||||
|
||||
|
@ -26,4 +26,5 @@ const scrollTop = (node) => {
|
|||
};
|
||||
};
|
||||
|
||||
export default scrollTop;
|
||||
export const scrollRight = (node) => scroll(node, 'scrollLeft', node.scrollWidth);
|
||||
export const scrollTop = (node) => scroll(node, 'scrollTop', 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue