mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-27 19:06:15 -04:00
Fix transition bug; add scrollIntoView.
This commit is contained in:
parent
d89babfaeb
commit
321aa05eab
1 changed files with 9 additions and 13 deletions
|
@ -348,35 +348,29 @@ $.Class("RevisionCache",
|
||||||
changesetsProcessed_callback(data.start);
|
changesetsProcessed_callback(data.start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var rounddown = function (a, b) {
|
var rounddown = function (a, b) {
|
||||||
return Math.floor(a / b) * b;
|
return Math.floor(a / b) * b;
|
||||||
};
|
};
|
||||||
var roundup = function (a, b) {
|
var roundup = function (a, b) {
|
||||||
return (Math.floor(a / b)+1) * b;
|
return (Math.floor(a / b)+1) * b;
|
||||||
};
|
};
|
||||||
//TODO: it might be better to be stricter about start addresses.
|
|
||||||
//At the moment if you request changesets from 2 -> 12, it will request at granularity 10.
|
|
||||||
//Not sure if we shouldn't only request granularities > 1 when we have a strict multiple of 10,100 etc.
|
|
||||||
//This is compounded by the fact that revisions are 1 based!
|
|
||||||
//TODO: we need to deal with the case where we need MORE THAN 100 of a particular granularity
|
|
||||||
//console.log("[requestChangesets] start: %d, end: %d, delta: %d, adelta: %d", start, end, delta, adelta);
|
//console.log("[requestChangesets] start: %d, end: %d, delta: %d, adelta: %d", start, end, delta, adelta);
|
||||||
for (var g in Revision.granularities) {
|
for (var g in Revision.granularities) {
|
||||||
var granularity = Revision.granularities[g];
|
var granularity = Revision.granularities[g];
|
||||||
var remainder = Math.floor(adelta / granularity);
|
var remainder = Math.floor(adelta / granularity);
|
||||||
//console.log("\t[requestChangesets] start: %d, granularity: %d, adelta: %d, //: %d", start, granularity, adelta, remainder);
|
//console.log("\t[requestChangesets] start: %d, granularity: %d, adelta: %d, //: %d", start, granularity, adelta, remainder);
|
||||||
//console.log("\t rounddown delta: %d, start: %d", rounddown(adelta, granularity), rounddown(start, granularity));
|
//console.log("\t rounddown delta: %d, start: %d", rounddown(adelta, granularity), rounddown(start, granularity));
|
||||||
//console.log("\t new start:", newstart);
|
|
||||||
if (remainder) {
|
if (remainder) {
|
||||||
//this.loader.enqueue(start, granularity, process_received_changesets);
|
//this.loader.enqueue(start, granularity, process_received_changesets);
|
||||||
console.log("\t[requestChangesets] REQUEST start: %d, end: %d, granularity: %d", rounddown(start, granularity), roundup(adelta, granularity), granularity);
|
//console.log("\t[requestChangesets] REQUEST start: %d, end: %d, granularity: %d", rounddown(start, granularity), roundup(adelta, granularity), granularity);
|
||||||
this.loader.enqueue(rounddown(start, granularity), granularity, process_received_changesets);
|
this.loader.enqueue(rounddown(start, granularity), granularity, process_received_changesets);
|
||||||
|
// for the next granularity, we assume that we have now successfully navigated
|
||||||
|
// as far as required for this granularity. We should also make sure that only
|
||||||
|
// the significant part of the adelta is used in the next granularity.
|
||||||
|
start = rounddown(start, granularity) + rounddown(adelta, granularity);
|
||||||
|
adelta = adelta - rounddown(adelta, granularity);
|
||||||
|
//console.log("\t new start: %d, delta: %d", start, adelta);
|
||||||
}
|
}
|
||||||
// for the next granularity, we assume that we have now successfully navigated
|
|
||||||
// as far as required for this granularity. We should also make sure that only
|
|
||||||
// the significant part of the adelta is used in the next granularity.
|
|
||||||
start = rounddown(start, granularity) + rounddown(adelta, granularity);
|
|
||||||
adelta = adelta - rounddown(adelta, granularity);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -808,6 +802,8 @@ $.Class("PadClient",
|
||||||
// otherwise just add the new divs after the index-th div
|
// otherwise just add the new divs after the index-th div
|
||||||
else
|
else
|
||||||
this.divs[index - 1].after(newdivs);
|
this.divs[index - 1].after(newdivs);
|
||||||
|
// super primitive scrollIntoView
|
||||||
|
newdivs[0][0].scrollIntoView(false);
|
||||||
|
|
||||||
// perform the splice on our array itself
|
// perform the splice on our array itself
|
||||||
// TODO: monkey patching divs.splice, so use divs.original_splice or something
|
// TODO: monkey patching divs.splice, so use divs.original_splice or something
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue