_isNebulaEvent()

in modules/main/src/lib/nebula.ts [78:106]


  _isNebulaEvent({ buttons, target, type }: Record<string, any>) {
    const { viewport } = this.props;

    // allow mouseup event aggressively to cancel drag properly
    // TODO: use pointer capture setPointerCapture() to capture mouseup properly after deckgl
    if (this._mouseWasDown && type === 'mouseup') {
      this._mouseWasDown = false;
      return true;
    }

    // allow mousemove event while dragging
    if (type === 'mousemove' && buttons > 0) {
      return true;
    }

    if (!target.getBoundingClientRect) {
      return false;
    }

    const rect = target.getBoundingClientRect();
    // Only listen to events coming from the basemap
    // identified by the canvas of the same size as viewport.
    // Need to round the rect dimension as some monitors
    // have some sub-pixel difference with viewport.
    return (
      Math.round(rect.width) === Math.round(viewport.width) &&
      Math.round(rect.height) === Math.round(viewport.height)
    );
  }