mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-02-17 04:11:23 -05:00
anim editor dropdown fix
This commit is contained in:
parent
ef6a5c033a
commit
2cfeb2c94d
1 changed files with 34 additions and 18 deletions
|
@ -40,6 +40,7 @@ import openfl.utils.ByteArray;
|
||||||
import funkin.input.Cursor;
|
import funkin.input.Cursor;
|
||||||
import funkin.play.character.CharacterData.CharacterDataParser;
|
import funkin.play.character.CharacterData.CharacterDataParser;
|
||||||
import funkin.util.SortUtil;
|
import funkin.util.SortUtil;
|
||||||
|
import haxe.ui.core.Screen;
|
||||||
|
|
||||||
using flixel.util.FlxSpriteUtil;
|
using flixel.util.FlxSpriteUtil;
|
||||||
|
|
||||||
|
@ -75,21 +76,19 @@ class DebugBoundingState extends FlxState
|
||||||
|
|
||||||
var uiStuff:Component;
|
var uiStuff:Component;
|
||||||
|
|
||||||
|
var haxeUIFocused(get, default):Bool = false;
|
||||||
|
|
||||||
|
function get_haxeUIFocused():Bool
|
||||||
|
{
|
||||||
|
// get the screen position, according to the HUD camera, temp default to FlxG.camera juuust in case?
|
||||||
|
var hudMousePos:FlxPoint = FlxG.mouse.getScreenPosition(hudCam ?? FlxG.camera);
|
||||||
|
return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y);
|
||||||
|
}
|
||||||
|
|
||||||
override function create()
|
override function create()
|
||||||
{
|
{
|
||||||
Paths.setCurrentLevel('week1');
|
Paths.setCurrentLevel('week1');
|
||||||
|
|
||||||
var str = Paths.xml('ui/animation-editor/offset-editor-view');
|
|
||||||
uiStuff = RuntimeComponentBuilder.fromAsset(str);
|
|
||||||
|
|
||||||
// uiStuff.findComponent("btnViewSpriteSheet").onClick = _ -> curView = SPRITESHEET;
|
|
||||||
var dropdown:DropDown = cast uiStuff.findComponent("swapper");
|
|
||||||
dropdown.onChange = function(e:UIEvent) {
|
|
||||||
trace(e.type);
|
|
||||||
curView = cast e.data.curView;
|
|
||||||
trace(e.data);
|
|
||||||
// trace(e.data);
|
|
||||||
};
|
|
||||||
// lv.
|
// lv.
|
||||||
// lv.onChange = function(e:UIEvent)
|
// lv.onChange = function(e:UIEvent)
|
||||||
// {
|
// {
|
||||||
|
@ -106,23 +105,40 @@ class DebugBoundingState extends FlxState
|
||||||
hudCam = new FlxCamera();
|
hudCam = new FlxCamera();
|
||||||
hudCam.bgColor.alpha = 0;
|
hudCam.bgColor.alpha = 0;
|
||||||
|
|
||||||
FlxG.cameras.add(hudCam, false);
|
|
||||||
|
|
||||||
bg = FlxGridOverlay.create(10, 10);
|
bg = FlxGridOverlay.create(10, 10);
|
||||||
// bg = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.GREEN);
|
// bg = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.GREEN);
|
||||||
|
|
||||||
bg.scrollFactor.set();
|
bg.scrollFactor.set();
|
||||||
add(bg);
|
add(bg);
|
||||||
|
|
||||||
initSpritesheetView();
|
// we are setting this as the default draw camera only temporarily, to trick haxeui
|
||||||
initOffsetView();
|
FlxG.cameras.add(hudCam);
|
||||||
|
|
||||||
Cursor.show();
|
var str = Paths.xml('ui/animation-editor/offset-editor-view');
|
||||||
|
uiStuff = RuntimeComponentBuilder.fromAsset(str);
|
||||||
|
|
||||||
|
// uiStuff.findComponent("btnViewSpriteSheet").onClick = _ -> curView = SPRITESHEET;
|
||||||
|
var dropdown:DropDown = cast uiStuff.findComponent("swapper");
|
||||||
|
dropdown.onChange = function(e:UIEvent) {
|
||||||
|
trace(e.type);
|
||||||
|
curView = cast e.data.curView;
|
||||||
|
trace(e.data);
|
||||||
|
// trace(e.data);
|
||||||
|
};
|
||||||
|
|
||||||
uiStuff.cameras = [hudCam];
|
uiStuff.cameras = [hudCam];
|
||||||
|
|
||||||
add(uiStuff);
|
add(uiStuff);
|
||||||
|
|
||||||
|
// sets the default camera back to FlxG.camera, since we set it to hudCamera for haxeui stuf
|
||||||
|
FlxG.cameras.setDefaultDrawTarget(FlxG.camera, true);
|
||||||
|
FlxG.cameras.setDefaultDrawTarget(hudCam, false);
|
||||||
|
|
||||||
|
initSpritesheetView();
|
||||||
|
initOffsetView();
|
||||||
|
|
||||||
|
Cursor.show();
|
||||||
|
|
||||||
super.create();
|
super.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +375,7 @@ class DebugBoundingState extends FlxState
|
||||||
offsetView.visible = true;
|
offsetView.visible = true;
|
||||||
offsetView.active = true;
|
offsetView.active = true;
|
||||||
offsetControls();
|
offsetControls();
|
||||||
mouseOffsetMovement();
|
if (!haxeUIFocused) mouseOffsetMovement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FlxG.keys.justPressed.H) hudCam.visible = !hudCam.visible;
|
if (FlxG.keys.justPressed.H) hudCam.visible = !hudCam.visible;
|
||||||
|
@ -367,7 +383,7 @@ class DebugBoundingState extends FlxState
|
||||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState());
|
if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState());
|
||||||
|
|
||||||
MouseUtil.mouseCamDrag();
|
MouseUtil.mouseCamDrag();
|
||||||
MouseUtil.mouseWheelZoom();
|
if (!haxeUIFocused) MouseUtil.mouseWheelZoom();
|
||||||
|
|
||||||
// bg.scale.x = FlxG.camera.zoom;
|
// bg.scale.x = FlxG.camera.zoom;
|
||||||
// bg.scale.y = FlxG.camera.zoom;
|
// bg.scale.y = FlxG.camera.zoom;
|
||||||
|
|
Loading…
Reference in a new issue