mirror of
https://github.com/wickedest/Mergely.git
synced 2026-04-25 12:08:34 +08:00
fix(#228): Clicking on edit marker in gutter now accounts for top position of editor.
This commit is contained in:
@@ -1190,7 +1190,9 @@ CodeMirrorDiffView.prototype._renderDiff = function(changes) {
|
|||||||
ex.lhs_scroller.scrollTo({ top: sto });
|
ex.lhs_scroller.scrollTo({ top: sto });
|
||||||
};
|
};
|
||||||
this._handleRhsMarginClick = function (ev) {
|
this._handleRhsMarginClick = function (ev) {
|
||||||
const y = ev.pageY - ex.rhs_xyoffset.top - (rto / 2);
|
// `top` accounts for the editor starting at position other than 0 on page
|
||||||
|
const { top } = ev.currentTarget.offsetParent.getBoundingClientRect();
|
||||||
|
const y = (ev.pageY - top) - ex.rhs_xyoffset.top - (rto / 2);
|
||||||
const sto = Math.max(0, (y / mcanvas_rhs.height) * ex.rhs_scroller.scrollHeight);
|
const sto = Math.max(0, (y / mcanvas_rhs.height) * ex.rhs_scroller.scrollHeight);
|
||||||
ex.rhs_scroller.scrollTo({ top: sto });
|
ex.rhs_scroller.scrollTo({ top: sto });
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user