FIX: Quote reply button not taking into scrolling offset.

This commit is contained in:
Guo Xiang Tan 2016-07-08 15:43:04 +08:00
parent 2484b8eb91
commit c6a6d6e1d6

View file

@ -72,7 +72,9 @@ export default Ember.Controller.extend({
range.insertNode(markerElement); range.insertNode(markerElement);
// retrieve the position of the marker // retrieve the position of the marker
const markerOffset = $(markerElement).offset(), const $markerElement = $(markerElement)
markerOffset = $markerElement.offset(),
parentScrollLeft = $markerElement.parent().scrollLeft(),
$quoteButton = $('.quote-button'); $quoteButton = $('.quote-button');
// remove the marker // remove the marker
@ -88,6 +90,8 @@ export default Ember.Controller.extend({
let topOff = markerOffset.top; let topOff = markerOffset.top;
let leftOff = markerOffset.left; let leftOff = markerOffset.left;
if (parentScrollLeft > 0) leftOff += parentScrollLeft;
if (isMobileDevice || isIOS || isAndroid) { if (isMobileDevice || isIOS || isAndroid) {
topOff = topOff + 20; topOff = topOff + 20;
leftOff = Math.min(leftOff + 10, $(window).width() - $quoteButton.outerWidth()); leftOff = Math.min(leftOff + 10, $(window).width() - $quoteButton.outerWidth());