- getPageXY(e)

Calculates the pageX and pageY using the screenX, screenY properties of the event
and the scrolling of the page. This is needed because the pageX and pageY
properties of the event are not correct while running tests in Edge.
195003
function (e) {
            // This code is inspired from https://stackoverflow.com/a/3464890
            var doc = document.documentElement,
                pageX = e.clientX + (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0),
                pageY = e.clientY + (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
            return { X: pageX, Y: pageY };
        }
1110638
int getAxis(LinuxEventBuffer buffer) {
        int axis = buffer.getEventCode();
        if (flipXY) {
            switch (axis) {
                case LinuxInput.ABS_X: return LinuxInput.ABS_Y;
                case LinuxInput.ABS_Y: return LinuxInput.ABS_X;
                case LinuxInput.ABS_MT_POSITION_X: return LinuxInput.ABS_MT_POSITION_Y;
                case LinuxInput.ABS_MT_POSITION_Y: return LinuxInput.ABS_MT_POSITION_X;
                default:
                    return axis;
            }
        } else {
            return axis;
        }
    }
978573
function getXY (type, pointer, xy) {
        xy = xy || {};
        type = type || 'page';

        xy.x = pointer[type + 'X'];
        xy.y = pointer[type + 'Y'];

        return xy;
    }
1000562
private float calculateDx(float distanceX) {
    int currentX = view.getScrollX();
    float nextX = distanceX + currentX;
    boolean isInsideHorizontally = nextX >= minX && nextX <= maxX;
    return isInsideHorizontally ? distanceX : 0;
  }
584957
function getMousePageX(evt) {
        var body = document.body;
        evt = evt || window.event;
        return (evt.pageX ||
        evt.clientX + ( document && document.scrollLeft || body && body.scrollLeft || 0 )
        - ( document && document.clientLeft || body && body.clientLeft || 0 ));
    }
1123202
function(e) {
		var tgt = YAHOO.util.Event.getTarget(e);
		var tgtPos = [tgt.offsetLeft, tgt.offsetTop];
		return [tgtPos[0]+e.layerX, tgtPos[1]+e.layerY];
   }
717160
function getScrollTop(){
  if ( typeof window.pageYOffset !== 'undefined' ) {
    // most browsers except IE before #9
    return window.pageYOffset;
  } else {
    var b = document.body; // IE 'quirks'
    var d = document.documentElement; // IE with doctype
    return ((d.clientHeight) ? d : b).scrollTop;
  }
}
889711
function getElementBoundingRect(elementSelector) {
    /**
     * @param {Window} win
     * @param {Object} [dims]
     * @returns {Object}
     */
    function computeFrameOffset(win, dims) {
        // initialize our result variable
        dims = dims || {
            left: win.pageXOffset,
            top: win.pageYOffset
        };

        // add the offset & recurse up the frame chain
        var frame = win.frameElement;
        if (frame) {
            var rect = frame.getBoundingClientRect();
            dims.left += rect.left + frame.contentWindow.pageXOffset;
            dims.top += rect.top + frame.contentWindow.pageYOffset;

            if (win !== window.top) {
                computeFrameOffset(win.parent, dims);
            }
        }

        return dims;
    }

    /**
     * @param {HTMLElement} element
     * @param {Object} frameOffset
     * @returns {Object}
     */
    function computeElementRect(element, frameOffset) {
        var rect = element.getBoundingClientRect();

        return {
            left: rect.left + frameOffset.left,
            right: rect.right + frameOffset.left,
            top: rect.top + frameOffset.top,
            bottom: rect.bottom + frameOffset.top,
            width: rect.width,
            height: rect.height
        };
    }

    var element = document.querySelectorAll(elementSelector)[0];
    if (element) {
        var frameOffset = computeFrameOffset(window);
        var elementRect = computeElementRect(element, frameOffset);

        return elementRect;
    }
}
427844
function getTopEdge(index, row) {
        return {
          index: index,
          y: editor.dom.getPos(row).y
        };
      }
152958
function getX(event) {
  let originalEvent = event.originalEvent;
  let touches = originalEvent? originalEvent.changedTouches : event.changedTouches;
  let touch = touches && touches[0];

  if (touch) {
    return touch.screenX;
  } else {
    return event.clientX;
  }
}
1053014
function (element) {
        var boundingClientRect = element[0].getBoundingClientRect();
        return {
          width: boundingClientRect.width || element.prop('offsetWidth'),
          height: boundingClientRect.height || element.prop('offsetHeight'),
          top: boundingClientRect.top + ($window.pageYOffset || $document[0].documentElement.scrollTop),
          left: boundingClientRect.left + ($window.pageXOffset || $document[0].documentElement.scrollLeft)
        };
      }
1330777
function getBottomEdge(index, row) {
        return {
          index: index,
          y: editor.dom.getPos(row).y + row.offsetHeight
        };
      }
381078
function getCoords(ev) {
          var x, y, w, h, el;

          // ignore browsers without pageX for now
          if (ev.pageX === null) return;

          x = ev.pageX;
          y = ev.pageY;
          el = self.element;

          // should probably check offsetParent
          // but this is more portable
          while (el !== document.documentElement) {
              x -= el.offsetLeft;
              y -= el.offsetTop;
              el = el.parentNode;
          }

          // convert to cols/rows
          w = self.element.clientWidth;
          h = self.element.clientHeight;
          x = ((x / w) * self.cols) | 0;
          y = ((y / h) * self.rows) | 0;

          // be sure to avoid sending
          // bad positions to the program
          if (x < 0) x = 0;
          if (x > self.cols) x = self.cols;
          if (y < 0) y = 0;
          if (y > self.rows) y = self.rows;

          // xterm sends raw bytes and
          // starts at 32 (SP) for each.
          x += 32;
          y += 32;

          return {
              x: x,
              y: y,
              down: ev.type === 'mousedown',
              up: ev.type === 'mouseup',
              wheel: ev.type === wheelEvent,
              move: ev.type === 'mousemove'
          };
      }
403247
function (e){

    var
      d = document,
      b = d.body,
      de = d.documentElement,
      axes = this.axes,
      plotOffset = this.plotOffset,
      lastMousePos = this.lastMousePos,
      pointer = E.eventPointer(e),
      dx = pointer.x - lastMousePos.pageX,
      dy = pointer.y - lastMousePos.pageY,
      r, rx, ry;

    if ('ontouchstart' in this.el) {
      r = D.position(this.overlay);
      rx = pointer.x - r.left - plotOffset.left;
      ry = pointer.y - r.top - plotOffset.top;
    } else {
      r = this.overlay.getBoundingClientRect();
      rx = e.clientX - r.left - plotOffset.left - b.scrollLeft - de.scrollLeft;
      ry = e.clientY - r.top - plotOffset.top - b.scrollTop - de.scrollTop;
    }

    return {
      x:  axes.x.p2d(rx),
      x2: axes.x2.p2d(rx),
      y:  axes.y.p2d(ry),
      y2: axes.y2.p2d(ry),
      relX: rx,
      relY: ry,
      dX: dx,
      dY: dy,
      absX: pointer.x,
      absY: pointer.y,
      pageX: pointer.x,
      pageY: pointer.y
    };
  }
73835
function(offset){
            if(arguments.length > 0){
                this.each(function(inx,ele){
                    var node = vQ(ele);
                    var coords = node.offset(),
                        parentOffset = ele.offsetParent.offset(),
                        props = {
                            top: coords.top - parentOffset.top,
                            left: coords.left - parentOffset.left
                        };
                    if (node.css('position') == 'static'){
                        props['position'] = 'relative';
                    }
                    node.css(props);
                });
            }
            if (!this.length) return null;
            if (!vQ.contains(document.documentElement, this[0]))
                return {top: 0, left: 0};
            var obj = this[0].getBoundingClientRect();
            return {
                left: obj.left + window.pageXOffset,
                top: obj.top + window.pageYOffset,
                width: Math.round(obj.width),
                height: Math.round(obj.height)
            };
        }
647783
function (e) {
    var node = ReactDOM.findDOMNode(this),
      numTabsMod = this.ctx.ownerId == this.memberId ? 0 : 1,
      tabWidth = node.offsetWidth / (this.tabKeys.length + numTabsMod),
      distance = e.pageX - node.getBoundingClientRect().left,
      index = parseInt(distance / tabWidth);

    this.tabWidth = tabWidth;
    return index;
  }
52062
def get_cursor_position(event)
      if (event.page_x && event.page_y)
        x = event.page_x
        y = event.page_y
      else
        doc = Opal.Document[0]
        x = event[:clientX] + doc.scrollLeft +
              doc.documentElement.scrollLeft
        y = event[:clientY] + doc.body.scrollTop +
              doc.documentElement.scrollTop
      end
      x -= `#{@canvas.canvas}.offsetLeft`
      y -= `#{@canvas.canvas}.offsetTop`
      Coordinates.new(x: x, y: y)
    end