Headlines.move: use requestAnimationFrame in CDM :(
This commit is contained in:
parent
8dc6b48ebd
commit
2deb9c555e
|
@ -832,8 +832,10 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
if (mode === "next") {
|
if (mode === "next") {
|
||||||
if (next_id) {
|
if (next_id) {
|
||||||
if (App.isCombinedMode()) {
|
if (App.isCombinedMode()) {
|
||||||
Article.setActive(next_id);
|
window.requestAnimationFrame(() => {
|
||||||
Article.cdmMoveToId(next_id, {event: event, noscroll: noscroll});
|
Article.setActive(next_id);
|
||||||
|
Article.cdmMoveToId(next_id, {event: event, noscroll: noscroll});
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Article.view(next_id, noexpand);
|
Article.view(next_id, noexpand);
|
||||||
}
|
}
|
||||||
|
@ -841,19 +843,19 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
} else if (mode === "prev") {
|
} else if (mode === "prev") {
|
||||||
if (prev_id || current_id) {
|
if (prev_id || current_id) {
|
||||||
if (App.isCombinedMode()) {
|
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);
|
||||||
|
|
||||||
const row = $("RROW-" + current_id);
|
if (row && delta_px > 16) {
|
||||||
const ctr = $("headlines-frame");
|
Article.setActive(current_id);
|
||||||
const delta_px = Math.max(row.offsetTop, ctr.scrollTop) - Math.min(row.offsetTop, ctr.scrollTop);
|
Article.cdmMoveToId(current_id, {force: noscroll, event: event});
|
||||||
|
} else if (prev_id) {
|
||||||
if (row && delta_px > 16) {
|
Article.setActive(prev_id);
|
||||||
Article.setActive(current_id);
|
Article.cdmMoveToId(prev_id, {force: noscroll, event: event, noscroll: noscroll});
|
||||||
Article.cdmMoveToId(current_id, {force: noscroll, event: event});
|
}
|
||||||
} else if (prev_id) {
|
});
|
||||||
Article.setActive(prev_id);
|
|
||||||
Article.cdmMoveToId(prev_id, {force: noscroll, event: event, noscroll: noscroll});
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (prev_id) {
|
} else if (prev_id) {
|
||||||
Article.view(prev_id, noexpand);
|
Article.view(prev_id, noexpand);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue