Repository: excalidraw/excalidraw
File: src/components/App.tsx (TypeScript)

Code before:
    // of z-index
    const elements = this.scene.getElements().slice().reverse();
    let hitElementIndex = Infinity;

    return elements.find((element, index) => {
      if (hitElement && element.id === hitElement.id) {
        hitElementIndex = index;
      }
      return (
        element.link &&
        isPointHittingLinkIcon(
          element,
          this.state,
          [scenePointer.x, scenePointer.y],
          this.isMobile,
        ) &&
        index <= hitElementIndex
      );
    });
  };

  private redirectToLink = () => {
    if (
      Math.abs(this.lastPointerDown!.clientX - this.lastPointerUp!.clientX) >
        10 ||
      Math.abs(this.lastPointerDown!.clientY - this.lastPointerUp!.clientY) > 10
    ) {
      return;
    }
    const lastPointerDownCoords = viewportCoordsToSceneCoords(
      this.lastPointerDown!,
      this.state,
    );
    const lastPointerDownHittingLinkIcon = isPointHittingLinkIcon(
      this.hitLinkElement!,
      this.state,
      [lastPointerDownCoords.x, lastPointerDownCoords.y],
      this.isMobile,
    );
    const lastPointerUpCoords = viewportCoordsToSceneCoords(
      this.lastPointerUp!,
      this.state,
    );
    const LastPointerUpHittingLinkIcon = isPointHittingLinkIcon(
      this.hitLinkElement!,
      this.state,
      [lastPointerUpCoords.x, lastPointerUpCoords.y],
      this.isMobile,
    );
    if (lastPointerDownHittingLinkIcon && LastPointerUpHittingLinkIcon) {
      const url = this.hitLinkElement?.link;

Review comment (suggestion):
```suggestion
      distance2d(
        this.lastPointerDown!.clientX,
        this.lastPointerDown!.clientY,
        this.lastPointerUp!.clientX,
        this.lastPointerUp!.clientY,
      ) > DRAGGING_THRESHOLD
```

This makes it it distance-consistent 

Code after:
  ): ExcalidrawElement | undefined => {
    // Reversing so we traverse the elements in decreasing order
    // of z-index
    const elements = this.scene.getElements().slice().reverse();
    let hitElementIndex = Infinity;

    return elements.find((element, index) => {
      if (hitElement && element.id === hitElement.id) {
        hitElementIndex = index;
      }
      return (
        element.link &&
        isPointHittingLinkIcon(
          element,
          this.state,
          [scenePointer.x, scenePointer.y],
          this.isMobile,
        ) &&
        index <= hitElementIndex
      );
    });
  };

  private redirectToLink = (
    event: React.PointerEvent<HTMLCanvasElement>,
    isTouchScreen: boolean,
  ) => {
    const draggedDistance = distance2d(
      this.lastPointerDown!.clientX,
      this.lastPointerDown!.clientY,
      this.lastPointerUp!.clientX,
      this.lastPointerUp!.clientY,
    );
    if (
      !this.hitLinkElement ||
      // For touch screen allow dragging threshold else strict check
      (isTouchScreen && draggedDistance > DRAGGING_THRESHOLD) ||
      (!isTouchScreen && draggedDistance !== 0)
    ) {
      return;
    }
    const lastPointerDownCoords = viewportCoordsToSceneCoords(
      this.lastPointerDown!,
      this.state,
    );
    const lastPointerDownHittingLinkIcon = isPointHittingLinkIcon(
      this.hitLinkElement!,
      this.state,
      [lastPointerDownCoords.x, lastPointerDownCoords.y],
      this.isMobile,
    );