Fixes autoupdate issue to ensure there is no update if scrolled or resized.

This commit is contained in:
Jamie Peabody
2013-06-20 22:36:01 +01:00
parent f77a66c398
commit 91f1a2158d

View File

@@ -460,7 +460,9 @@ jQuery.extend(Mgly.mergely.prototype, {
if (self.settings.resize) self.settings.resize();
self.editor[self.id + '-lhs'].refresh();
self.editor[self.id + '-rhs'].refresh();
self._changing(self.id + '-lhs', self.id + '-rhs');
if (self.settings.autoupdate) {
self._changing(self.id + '-lhs', self.id + '-rhs');
}
}
jQuery(window).resize(
function () {
@@ -710,15 +712,16 @@ jQuery.extend(Mgly.mergely.prototype, {
scroller.scrollTop(top_to - top_adjust).scrollLeft(left_to);
}
else this.trace('scroll', 'not scrolling other side');
var timer = new Mgly.Timer();
this._calculate_offsets(editor_name1, editor_name2, this.changes);
this.trace('change', 'offsets time', timer.stop());
this._markup_changes(editor_name1, editor_name2, this.changes);
this.trace('change', 'markup time', timer.stop());
this._draw_diff(editor_name1, editor_name2, this.changes);
this.trace('change', 'draw time', timer.stop());
if (this.settings.autoupdate) {
var timer = new Mgly.Timer();
this._calculate_offsets(editor_name1, editor_name2, this.changes);
this.trace('change', 'offsets time', timer.stop());
this._markup_changes(editor_name1, editor_name2, this.changes);
this.trace('change', 'markup time', timer.stop());
this._draw_diff(editor_name1, editor_name2, this.changes);
this.trace('change', 'draw time', timer.stop());
}
this.trace('scroll', 'scrolled');
}
},