Skip to content

Commit

Permalink
Fix maths for scroll-triggered big frame parsing
Browse files Browse the repository at this point in the history
Big frames (ie plus and minus 6 or so frame heights) should only be sent
when plus or minus 6 frame heights have been scrolled.
  • Loading branch information
tombh committed Jun 5, 2018
1 parent d6406ac commit 3d39cf8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion webext/src/dom/commands_mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ export default (MixinBase) => class extends MixinBase {
_mightSendBigFrames() {
if (this._is_raw_text_mode) { return }
const y_diff = this.dimensions.frame.y_last_big_frame - this.dimensions.frame.y_scroll;
const max_y_scroll_without_new_big_frame = 2 * this.dimensions.tty.height;
const max_y_scroll_without_new_big_frame =
(this.dimensions._big_sub_frame_factor - 1) * this.dimensions.tty.height;
if (Math.abs(y_diff) > max_y_scroll_without_new_big_frame) {
this.log(
`Parsing big frames: ` +
Expand Down
4 changes: 2 additions & 2 deletions webext/src/dom/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export default class extends utils.mixins(CommonMixin) {
_calculateBigSubFrame() {
this.frame.sub = {
left: this.frame.x_scroll - (this._big_sub_frame_factor * this.tty.width),
top: this.frame.y_scroll - (this._big_sub_frame_factor * this.tty.height),
top: this.frame.y_scroll - (this._big_sub_frame_factor * this.tty.height * 2),
width: this.tty.width + (this._big_sub_frame_factor * 2 * this.tty.width),
height: this.tty.height + (this._big_sub_frame_factor * 2 * this.tty.height),
height: this.tty.height + (this._big_sub_frame_factor * 2 * this.tty.height * 2),
}
this._limitSubFrameDimensions();
this._scaleSubFrameToSubDOM();
Expand Down

0 comments on commit 3d39cf8

Please sign in to comment.