提交 53a1404a 编写于 作者: A Alex Dima

Validate outstanding animated scroll position target when the scroll dimensions change

上级 90377a73
......@@ -208,8 +208,10 @@ export class Scrollable extends Disposable {
const newState = this._state.withScrollDimensions(dimensions);
this._setState(newState);
// TODO@smooth: [MUST] validate outstanding animated scroll position request target
// (in case it becomes invalid)
// Validate outstanding animated scroll position target
if (this._smoothScrolling) {
this._smoothScrolling.acceptScrollDimensions(this._state);
}
}
/**
......@@ -313,7 +315,7 @@ class SmoothScrollingUpdate implements IScrollPosition {
class SmoothScrollingOperation {
public readonly from: IScrollPosition;
public readonly to: IScrollPosition;
public to: IScrollPosition;
public readonly duration: number;
private readonly _startTime: number;
public animationFrameToken: number;
......@@ -340,6 +342,10 @@ class SmoothScrollingOperation {
}
}
public acceptScrollDimensions(state: ScrollState): void {
this.to = state.withScrollPosition(this.to);
}
public tick(): SmoothScrollingUpdate {
const completion = (Date.now() - this._startTime) / this.duration;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册