Headlines.move: use requestAnimationFrame in CDM :(

This commit is contained in:
Andrew Dolgov 2020-05-19 08:07:23 +03:00
parent 8dc6b48ebd
commit 2deb9c555e
1 changed files with 16 additions and 14 deletions

View File

@ -832,8 +832,10 @@ define(["dojo/_base/declare"], function (declare) {
if (mode === "next") {
if (next_id) {
if (App.isCombinedMode()) {
window.requestAnimationFrame(() => {
Article.setActive(next_id);
Article.cdmMoveToId(next_id, {event: event, noscroll: noscroll});
});
} else {
Article.view(next_id, noexpand);
}
@ -841,7 +843,7 @@ define(["dojo/_base/declare"], function (declare) {
} else if (mode === "prev") {
if (prev_id || current_id) {
if (App.isCombinedMode()) {
window.requestAnimationFrame(() => {
const row = $("RROW-" + current_id);
const ctr = $("headlines-frame");
const delta_px = Math.max(row.offsetTop, ctr.scrollTop) - Math.min(row.offsetTop, ctr.scrollTop);
@ -853,7 +855,7 @@ define(["dojo/_base/declare"], function (declare) {
Article.setActive(prev_id);
Article.cdmMoveToId(prev_id, {force: noscroll, event: event, noscroll: noscroll});
}
});
} else if (prev_id) {
Article.view(prev_id, noexpand);
}