Fixed noAnimation: previously, the opposite of what was requested happened

This commit is contained in:
Alexander Skvortsov 2020-09-25 16:02:39 -04:00
parent 6508e64f55
commit 4c3e1e2625
2 changed files with 4 additions and 4 deletions

View File

@ -132,10 +132,10 @@ export default class PostStream extends Component {
} }
if ('number' in newTarget) { if ('number' in newTarget) {
this.scrollToNumber(newTarget.number, this.stream.noAnimationScroll); this.scrollToNumber(newTarget.number, this.stream.animateScroll);
} else if ('index' in newTarget) { } else if ('index' in newTarget) {
const backwards = newTarget.index === this.stream.count() - 1; const backwards = newTarget.index === this.stream.count() - 1;
this.scrollToIndex(newTarget.index, this.stream.noAnimationScroll, backwards); this.scrollToIndex(newTarget.index, this.stream.animateScroll, backwards);
} }
this.prevTarget = newTarget; this.prevTarget = newTarget;

View File

@ -104,7 +104,7 @@ class PostStreamState {
this.loadPromise = this.loadNearNumber(number); this.loadPromise = this.loadNearNumber(number);
this.targetPost = { number }; this.targetPost = { number };
this.noAnimationScroll = noAnimation; this.animateScroll = !noAnimation;
this.number = number; this.number = number;
// In this case, the redraw is only called after the response has been loaded // In this case, the redraw is only called after the response has been loaded
@ -128,7 +128,7 @@ class PostStreamState {
this.loadPromise = this.loadNearIndex(index); this.loadPromise = this.loadNearIndex(index);
this.targetPost = { index }; this.targetPost = { index };
this.noAnimationScroll = noAnimation; this.animateScroll = !noAnimation;
this.index = index; this.index = index;
m.redraw(); m.redraw();