• Robert Knight's avatar
    Fix adder position when document or body position is offset. · efbdc813
    Robert Knight authored
    Fix positioning of the adder when the document or body elements are
    positioned and offset relative to their default position.
    
    There were two problems:
    
     1. When converting from viewport to "document" coordinates, code in
        `adder.js` and `range-util.js` failed to account for the document
        element's position being offset from the default (0, 0) location.
     2. When setting the adder's top/left coords, `Adder#showAt`
        did not take into account the offset of the body element from the
        document.
    
    This commit fixes the issue by:
    
     1. Using viewport coordinates as far as possible in the range-util and
        Adder functions to reduce the need for converting coordinates.
    
     2. Calculating the position of the adder by comparing the target
        viewport coordinates for the adder and the viewport coordinates of
        the adder's nearest positioned ancestor.
    
    Fixes #487
    efbdc813
adder.js 8.94 KB