From b42e4ceb67ce781727d7324daec70ec6334b15f2 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 12 Sep 2023 23:37:07 -0400 Subject: [PATCH] Fix cursor modes on toolboxes. --- .../charting/ChartEditorToolboxHandler.hx | 1 + .../ui/haxeui/components/FunkinDropdown.hx | 30 +++++++++++++++++++ .../haxeui/components/FunkinNumberStepper.hx | 30 +++++++++++++++++++ .../ui/haxeui/components/FunkinTextField.hx | 30 +++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 source/funkin/ui/haxeui/components/FunkinDropdown.hx create mode 100644 source/funkin/ui/haxeui/components/FunkinNumberStepper.hx create mode 100644 source/funkin/ui/haxeui/components/FunkinTextField.hx diff --git a/source/funkin/ui/debug/charting/ChartEditorToolboxHandler.hx b/source/funkin/ui/debug/charting/ChartEditorToolboxHandler.hx index 7833e19fd..db090542d 100644 --- a/source/funkin/ui/debug/charting/ChartEditorToolboxHandler.hx +++ b/source/funkin/ui/debug/charting/ChartEditorToolboxHandler.hx @@ -1,5 +1,6 @@ package funkin.ui.debug.charting; +import haxe.ui.components.HorizontalSlider; import haxe.ui.containers.TreeView; import haxe.ui.containers.TreeViewNode; import funkin.play.character.BaseCharacter.CharacterType; diff --git a/source/funkin/ui/haxeui/components/FunkinDropdown.hx b/source/funkin/ui/haxeui/components/FunkinDropdown.hx new file mode 100644 index 000000000..ad396856c --- /dev/null +++ b/source/funkin/ui/haxeui/components/FunkinDropdown.hx @@ -0,0 +1,30 @@ +package funkin.ui.haxeui.components; + +import haxe.ui.components.DropDown; +import funkin.input.Cursor; +import haxe.ui.events.MouseEvent; + +/** + * A HaxeUI dropdown which: + * - Changes the current cursor when hovered over. + */ +class FunkinDropDown extends DropDown +{ + public function new() + { + super(); + + this.onMouseOver = handleMouseOver; + this.onMouseOut = handleMouseOut; + } + + private function handleMouseOver(event:MouseEvent) + { + Cursor.cursorMode = Pointer; + } + + private function handleMouseOut(event:MouseEvent) + { + Cursor.cursorMode = Default; + } +} diff --git a/source/funkin/ui/haxeui/components/FunkinNumberStepper.hx b/source/funkin/ui/haxeui/components/FunkinNumberStepper.hx new file mode 100644 index 000000000..db8d4fb7f --- /dev/null +++ b/source/funkin/ui/haxeui/components/FunkinNumberStepper.hx @@ -0,0 +1,30 @@ +package funkin.ui.haxeui.components; + +import haxe.ui.components.NumberStepper; +import funkin.input.Cursor; +import haxe.ui.events.MouseEvent; + +/** + * A HaxeUI number stepper which: + * - Changes the current cursor when hovered over. + */ +class FunkinNumberStepper extends NumberStepper +{ + public function new() + { + super(); + + this.onMouseOver = handleMouseOver; + this.onMouseOut = handleMouseOut; + } + + private function handleMouseOver(event:MouseEvent) + { + Cursor.cursorMode = Pointer; + } + + private function handleMouseOut(event:MouseEvent) + { + Cursor.cursorMode = Default; + } +} diff --git a/source/funkin/ui/haxeui/components/FunkinTextField.hx b/source/funkin/ui/haxeui/components/FunkinTextField.hx new file mode 100644 index 000000000..3ecab0684 --- /dev/null +++ b/source/funkin/ui/haxeui/components/FunkinTextField.hx @@ -0,0 +1,30 @@ +package funkin.ui.haxeui.components; + +import haxe.ui.components.TextField; +import funkin.input.Cursor; +import haxe.ui.events.MouseEvent; + +/** + * A HaxeUI text field which: + * - Changes the current cursor when hovered over. + */ +class FunkinTextField extends TextField +{ + public function new() + { + super(); + + this.onMouseOver = handleMouseOver; + this.onMouseOut = handleMouseOut; + } + + private function handleMouseOver(event:MouseEvent) + { + Cursor.cursorMode = Text; + } + + private function handleMouseOut(event:MouseEvent) + { + Cursor.cursorMode = Default; + } +}