ok it acuttaly works now
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user