Skip to content

Improve FlxSlider dragging#477

Open
riconuts wants to merge 1 commit intoHaxeFlixel:devfrom
riconuts:patch-1
Open

Improve FlxSlider dragging#477
riconuts wants to merge 1 commit intoHaxeFlixel:devfrom
riconuts:patch-1

Conversation

@riconuts
Copy link
Copy Markdown

Currently, just moving the mouse over an FlxSlider while holding left click moves the slider, which can be a bit annoying.

Similarly, the slider only moves if you're hovering over it, which sounds correct but it makes moving the slider to the min/max difficult if the framerate is low or if you do it fast enough.

Unrelated to the above, FlxSlider requires an object and is unusable without one, considering you can give it a callback I think this shouldn't be necessary :>

Here's a demonstration of all of the mentioned issues:

current.mp4

And here's how FlxSlider behaves with the changes I made:

fixed.mp4

Plus the test code I used, just in case :>

import flixel.FlxG;
import flixel.FlxState;
import flixel.addons.ui.FlxSlider;
import flixel.text.FlxText;

class BubState extends FlxState {
	var mouseStatusTxt:FlxText;

	override function create() {
		super.create();

		FlxG.camera.bgColor = 0xFFAAAAAA;
		var obj = {v1: 0.0, v2: 0.0, v3: 0.0};
		add(new FlxSlider(obj, "v1", 100, 50)); 
		add(new FlxSlider(obj, "v2", 100, 150)); 
		add(new FlxSlider(obj, "v3", 100, 250));
		add(new FlxSlider(null, "null object", 300, 250));

		mouseStatusTxt = new FlxText();
		mouseStatusTxt.color = 0xFF000000;
		add(mouseStatusTxt);
	}

	override function update(elapsed:Float) {
		mouseStatusTxt.text = FlxG.mouse.pressed ? "LEFT CLICK PRESSED" : "";
		super.update(elapsed);
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant