handleMouseEvent method

void handleMouseEvent(
  1. String eventType,
  2. TapUpDetails details
)
inherited

Implementation

void handleMouseEvent(String eventType, TapUpDetails details) {
  RenderBoxModel? root = elementManager.viewportElement.renderBoxModel;
  if (root == null) {
    return;
  }

  // When Kraken wraps the Flutter Widget, Kraken need to calculate the global coordinates relative to self.
  Offset globalOffset = root.globalToLocal(Offset(details.globalPosition.dx, details.globalPosition.dy));
  dispatchEvent(MouseEvent(eventType,
    MouseEventInit(
      bubbles: true,
      cancelable: true,
      clientX: globalOffset.dx,
      clientY: globalOffset.dy,
      offsetX: details.localPosition.dx,
      offsetY: details.localPosition.dy,
    )
  ));
}