getPointer method

dynamic getPointer(
  1. dynamic event
)

Implementation

getPointer(event) {
  final RenderBox renderBox = domKey.currentContext!.findRenderObject();
  final size = renderBox.size;
  var rect = size;
  int left = 0;
  int top = 0;

  var _x = (event.clientX - left) / rect.width * 2 - 1;
  var _y = -(event.clientY - top) / rect.height * 2 + 1;
  var _button = event.button;

  return Pointer(_x, _y, _button);
}