From 965ff2f26bab0e5342110cbd38f23dbad8cc737f Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Mon, 31 Jul 2023 04:18:03 -0700 Subject: [PATCH] ok fixed i think --- .../editors/character/CharacterEditor.hx | 28 +++++++++---------- .../character/CharacterPropertiesWindow.hx | 8 ------ source/funkin/editors/ui/UIButtonList.hx | 2 ++ source/funkin/editors/ui/UIWindow.hx | 8 ++++++ 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index add499c2..f49d4d5d 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -265,7 +265,7 @@ class CharacterEditor extends UIState { if (character != null) characterPropertiresWindow.characterInfo.text = '(${character.getNameList().length}) Animations\nFlipped: ${character.flipX}\nSprite: ${character.sprite}\nAnim: ${character.getAnimName()}\nOffset: (${character.frameOffset.x}, ${character.frameOffset.y})'; - if (!(characterPropertiresWindow.hovered || characterAnimsWindow.hovered)) { + if (!(characterPropertiresWindow.hovered || characterAnimsWindow.hovered) && !characterAnimsWindow.dragging) { if (FlxG.mouse.wheel != 0) { zoom += 0.25 * FlxG.mouse.wheel; __camZoom = Math.pow(2, zoom); @@ -275,22 +275,22 @@ class CharacterEditor extends UIState { closeCurrentContextMenu(); openContextMenu(topMenu[2].childs); } - } + if (FlxG.mouse.justPressed) { + FlxG.mouse.getScreenPosition(charCamera, camDrag); + camDrag *= camDragSpeed; + camDrag += charCamera.scroll; + } - if (FlxG.mouse.justPressed) { - FlxG.mouse.getScreenPosition(charCamera, camDrag); - camDrag *= camDragSpeed; - camDrag += charCamera.scroll; - } + if (FlxG.mouse.pressed) { + var pos = FlxG.mouse.getScreenPosition(charCamera); + pos *= camDragSpeed; + nextScroll.set((camDrag.x - pos.x), (camDrag.y - pos.y)); - if (FlxG.mouse.pressed) { - var pos = FlxG.mouse.getScreenPosition(charCamera); - pos *= camDragSpeed; - nextScroll.set((camDrag.x - pos.x), (camDrag.y - pos.y)); - - currentCursor = HAND; - } else + currentCursor = HAND; + } else + currentCursor = ARROW; + } else if (!FlxG.mouse.pressed) currentCursor = ARROW; charCamera.scroll.set( diff --git a/source/funkin/editors/character/CharacterPropertiesWindow.hx b/source/funkin/editors/character/CharacterPropertiesWindow.hx index 06795eb1..f13478c7 100644 --- a/source/funkin/editors/character/CharacterPropertiesWindow.hx +++ b/source/funkin/editors/character/CharacterPropertiesWindow.hx @@ -24,12 +24,4 @@ class CharacterPropertiesWindow extends UIWindow { characterInfo.alignment = LEFT; members.push(characterInfo); } - - public override function update(elapsed:Float) { - super.update(elapsed); - - __rect.x = x; __rect.y = y+23; - __rect.width = bWidth; __rect.height = bHeight-23; - hovered = UIState.state.isOverlapping(this, __rect); - } } \ No newline at end of file diff --git a/source/funkin/editors/ui/UIButtonList.hx b/source/funkin/editors/ui/UIButtonList.hx index 1c2074d0..c5afed15 100644 --- a/source/funkin/editors/ui/UIButtonList.hx +++ b/source/funkin/editors/ui/UIButtonList.hx @@ -14,6 +14,7 @@ class UIButtonList extends UIWindow { public var addIcon:FlxSprite; public var buttonCameras:FlxCamera; public var cameraSpacing = 36; + public var dragging:Bool = false; var _buttonXOffset:Float = 16; var _buttonYOffset:Float = 16; @@ -106,5 +107,6 @@ class UIButtonList extends UIWindow { buttonCameras.y = y + cameraSpacing - __lastDrawCameras[0].scroll.y; buttonCameras.zoom = __lastDrawCameras[0].zoom; } + dragging = _curMoving != null; } } \ No newline at end of file diff --git a/source/funkin/editors/ui/UIWindow.hx b/source/funkin/editors/ui/UIWindow.hx index c1320599..2346d995 100644 --- a/source/funkin/editors/ui/UIWindow.hx +++ b/source/funkin/editors/ui/UIWindow.hx @@ -9,4 +9,12 @@ class UIWindow extends UISliceSprite { members.push(titleSpr = new UIText(x + 25, y, bWidth - 50, title, 15, -1)); titleSpr.y = y + ((30 - titleSpr.height) / 2); } + + public override function update(elapsed:Float) { + super.update(elapsed); + + __rect.x = x; __rect.y = y+23; + __rect.width = bWidth; __rect.height = bHeight-23; + hovered = UIState.state.isOverlapping(this, __rect); + } } \ No newline at end of file