updatePointer method

dynamic updatePointer(
  1. dynamic event
)

Implementation

updatePointer(event) {
  // var rect = _domElement.getBoundingClientRect();
  var box = listenableKey.currentContext?.findRenderObject() as RenderBox;
  var size = box.size;
  var local = box.globalToLocal(Offset(0, 0));

  _pointer.x = (event.clientX - local.dx) / size.width * 2 - 1;
  _pointer.y = -(event.clientY - local.dy) / size.height * 2 + 1;
}