Skip to content

Commit

Permalink
Update event
Browse files Browse the repository at this point in the history
  • Loading branch information
hackermdch committed Sep 20, 2024
1 parent 3824d4d commit 18a3704
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,14 @@ public static boolean onMouseButton(int phase, double x, double y) {
}
return false;
}

public static boolean onMouseMove(double x, double y) {
for (var i : instances) {
if (i.hitTest(x, y)) {
FlutterNative.sendPosEvent(i.handle, PointerPhase.kHover, x - i.rect.left, y - i.rect.top, 0);
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@ private void onMouseButton(long window, int button, int action, int modifiers, C
if (MouseEvent.onMouseButton(PointerPhase.kUp, x[0], y[0])) ci.cancel();
}
}

@Inject(method = "onMove", at = @At("HEAD"), cancellable = true)
private void onMouseMove(long window, double x, double y, CallbackInfo ci) {
if (window != minecraft.getWindow().getWindow()) return;
if (MouseEvent.onMouseMove(x, y)) ci.cancel();
}
}

0 comments on commit 18a3704

Please sign in to comment.