Get topmost layer that intersects with event coordinates
352162
function _getIntersectingLayer(data) {
	var layer, i,
		mask, m;

	// Store the topmost layer
	layer = null;

	// Get the topmost layer whose visible area intersects event coordinates
	for (i = data.intersecting.length - 1; i >= 0; i -= 1) {

		// Get current layer
		layer = data.intersecting[i];

		// If layer has previous masks
		if (layer._masks) {

			// Search previous masks to ensure
			// layer is visible at event coordinates
			for (m = layer._masks.length - 1; m >= 0; m -= 1) {
				mask = layer._masks[m];
				// If mask does not intersect event coordinates
				if (!mask.intersects) {
					// Indicate that the mask does not
					// intersect event coordinates
					layer.intersects = false;
					// Stop searching previous masks
					break;
				}

			}

			// If event coordinates intersect all previous masks
			// and layer is not intangible
			if (layer.intersects && !layer.intangible) {
				// Stop searching for topmost layer
				break;
			}

		}

	}
	// If resulting layer is intangible
	if (layer && layer.intangible) {
		// Cursor does not intersect this layer
		layer = null;
	}
	return layer;
}
1260560
function getMouseEventInfo(event, divElt) {
  const clientRect = divElt.getBoundingClientRect();
  return {
    relX: event.clientX - clientRect.left,
    relY: event.clientY - clientRect.top,
    eltBounds: clientRect,
  };
}
850743
function(el) {
      var intersect = false;
      if (el.getBoundingClientRect) {
        var elRect = el.getBoundingClientRect();
        intersect = {'top': Math.max(elRect.top, 0),
                         'left': Math.max(elRect.left, 0),
                         'bottom': Math.min(elRect.bottom, (win.innerHeight || doc.documentElement.clientHeight)),
                         'right': Math.min(elRect.right, (win.innerWidth || doc.documentElement.clientWidth))};
        if (intersect.bottom <= intersect.top ||
            intersect.right <= intersect.left) {
          intersect = false;
        } else {
          intersect.area = (intersect.bottom - intersect.top) * (intersect.right - intersect.left);
        }
      }
      return intersect;
    }
984569
function collides(element_one, element_two) {

	var result,
	    rect1,
	    rect2;

	if (element_one.nodeName) {
		rect1 = element_one.getBoundingClientRect();
	} else {
		rect1 = element_one;
	}

	if (element_two.nodeName) {
		rect2 = element_two.getBoundingClientRect();
	} else {
		rect2 = element_two;
	}

	result = !(
		rect1.top    > rect2.bottom ||
		rect1.right  < rect2.left ||
		rect1.bottom < rect2.top ||
		rect1.left   > rect2.right
	);

	return result;
}
578511
function (e) {
		var point = this._map.mouseEventToLayerPoint(e), layers = [], layer;

		for (var id in this._layers) {
			layer = this._layers[id];
			if (layer.options.interactive && layer._containsPoint(point) && !this._map._draggableMoved(layer)) {
				L.DomEvent._fakeStop(e);
				layers.push(layer);
			}
		}
		if (layers.length)  {
			this._fireEvent(layers, e);
		}
	}
1224411
function offsetTop (elem) {
    let top = 0

    do {
      if (!isNaN(elem.offsetTop)) top += elem.offsetTop
    } while (elem = elem.offsetParent)

    return top
  }
296393
def getTopLeft(self):
        
        return (float(self.get_x()), float(self.get_y())+ float(self.get_height()))
518893
@Api
	public void onSelectLayer(LayerSelectedEvent event) {
		for (TreeNode node : tree.getAllNodes()) {
			if (node.getName().equals(event.getLayer().getLabel())) {
				selectedLayerTreeNode = (LayerTreeTreeNode) node;
				treeGrid.selectRecord(selectedLayerTreeNode);
				htmlSelectedLayer.setContents(I18nProvider.getLayerTree().activeLayer(
						selectedLayerTreeNode.getLayer().getLabel()));

				Canvas[] toolStripMembers = toolStrip.getMembers();
				updateButtonIconsAndStates(toolStripMembers);
			}
		}
	}
965568
protected Coordinate getWorldPosition(MouseEvent<?> event) {
		Coordinate world = super.getWorldPosition(event);
		if (snappingActive) {
			return snapper.snap(world);
		}
		return world;
	}
85318
function (event) {
            return {
                x: event.pageX - this._position.x,
                y: event.pageY - this._position.y
            };
        }
839192
function(x, y){
            var pos = this.canvas.getBoundingClientRect(),
                mx = x - pos.left,
                my = y - pos.top;
            return this.pixelToTileCoords(mx, my);
        }
1000524
def find_last_intersection(edges, i, e)
	    intersection, intersection_at = nil, nil
	    for j in i..(edges.count-1)
		e2 = edges[j][:edge]
		next if !e2 || e.connected?(e2)
		_intersection = e.intersection(e2)
		intersection, intersection_at = _intersection, j if _intersection
	    end
	    [intersection, intersection_at]
	end
850414
public static boolean intersectsPointWithRectF(RectF _Rect, float _X, float _Y) {
        return _X > _Rect.left && _X < _Rect.right && _Y > _Rect.top && _Y < _Rect.bottom;
    }
507198
function computeIntersection(rootRect, targetRect) {
    const left      = Math.max(targetRect.left, rootRect.left);
    const right     = Math.min(targetRect.right, rootRect.right);
    const top       = Math.max(targetRect.top, rootRect.top);
    const bottom    = Math.min(targetRect.bottom, rootRect.bottom);

    const width = right - left;
    const height = bottom - top;

    return createRectangle(left, top, width, height);
}
1315824
function getNormalizedEventCoords(ev, pageOffset, clientRect) {
  const { x, y } = pageOffset;
  const documentX = x + clientRect.left;
  const documentY = y + clientRect.top;

  let normalizedX;
  let normalizedY;
  // Determine touch point relative to the ripple container.
  if (ev.type === 'touchstart') {
    normalizedX = ev.changedTouches[0].pageX - documentX;
    normalizedY = ev.changedTouches[0].pageY - documentY;
  } else {
    normalizedX = ev.pageX - documentX;
    normalizedY = ev.pageY - documentY;
  }

  return { x: normalizedX, y: normalizedY };
}
239412
function(evt) {
        if (evt instanceof MapBrowserEvent && !evt.dragging) {
          const pixel = map.getEventPixel(evt.originalEvent);
          const queryable = function(layer) {
            const visible = layer.get('visible');
            const sourceids = layer.get('querySourceIds');
            return visible && !!sourceids;
          };
          const hit = map.forEachLayerAtPixel(pixel, () => true, undefined, queryable);
          map.getTargetElement().style.cursor = hit ? 'pointer' : '';
        }
      }
348158
function (evt) {
    var currentIntersection;
    var cursorEl = this.el;
    var index;
    var intersectedEl;
    var intersection;

    // Select closest object, excluding the cursor.
    index = evt.detail.els[0] === cursorEl ? 1 : 0;
    intersection = evt.detail.intersections[index];
    intersectedEl = evt.detail.els[index];

    // If cursor is the only intersected object, ignore the event.
    if (!intersectedEl) { return; }

    // Already intersecting this entity.
    if (this.intersectedEl === intersectedEl) { return; }

    // Ignore events further away than active intersection.
    if (this.intersectedEl) {
      currentIntersection = this.el.components.raycaster.getIntersection(this.intersectedEl);
      if (currentIntersection && currentIntersection.distance <= intersection.distance) { return; }
    }

    // Unset current intersection.
    this.clearCurrentIntersection(true);

    this.setIntersection(intersectedEl, intersection);
  }