ok it acuttaly works now

This commit is contained in:
lunarcleint
2023-07-14 17:11:26 -07:00
parent 8a23331f82
commit 027f63d464
3 changed files with 13 additions and 21 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ class UISprite extends FlxSprite {
public var cursor:MouseCursor = ARROW;
public var focused(get, set):Bool;
public var cameraLocked:Bool = false;
public var selectable:Bool = true;
private inline function get_focused():Bool
return UIState.state.currentFocus == cast this;
@@ -44,7 +44,7 @@ class UISprite extends FlxSprite {
hoveredByChild = false;
super.update(elapsed);
if (cameraLocked ? UIState.state.checkMouseOnCam(this) : true)
if (selectable)
updateButton();
@:privateAccess {
-10
View File
@@ -60,16 +60,6 @@ class UIState extends MusicBeatState {
updateRectButtonHandler(spr, spr.__rect, buttonHandler);
}
public function checkMouseOnCam(spr:UISprite) {
for(camera in spr.__lastDrawCameras) {
var pos = FlxG.mouse.getScreenPosition(FlxG.camera, FlxPoint.get());
if (((pos.x > camera.x) && (pos.x < camera.x + camera.width)) && ((pos.y > camera.y) && (pos.y < camera.y + camera.height)))
return true;
}
return false;
}
public function isOverlapping(spr:UISprite, rect:FlxRect) {
for(camera in spr.__lastDrawCameras) {
var pos = FlxG.mouse.getScreenPosition(camera, FlxPoint.get());