Skip to content

Commit

Permalink
Merge pull request #573 from Shallowmallow/CorrectScrollingEvent
Browse files Browse the repository at this point in the history
Correct scrolling event
  • Loading branch information
ianharrigan authored Jan 29, 2024
2 parents c819107 + 85fd5a7 commit 291f9b6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions haxe/ui/components/Scroll.hx
Original file line number Diff line number Diff line change
Expand Up @@ -211,24 +211,25 @@ private class ScrollValueBehaviour extends DataBehaviour {
return;
}

var scroll:Scroll = cast(_component, Scroll);
var min:Float = scroll.min;
var max:Float = scroll.max;
if (value < min) {
value = min;
} else if (value > max) {
value = max;
}

super.set(value);
_component.invalidateComponentLayout();
}

private override function validateData() {
var scroll:Scroll = cast(_component, Scroll);
var pos:Float = scroll.pos;
var min:Float = scroll.min;
var max:Float = scroll.max;
if (pos < min) {
scroll.pos = min;
} else if (pos > max) {
scroll.pos = max;
}

var changeEvent:UIEvent = new UIEvent(UIEvent.CHANGE);
changeEvent.previousValue = _previousValue;
changeEvent.value = pos;
changeEvent.value = _value;
scroll.dispatch(changeEvent);

var scrollEvent:ScrollEvent = new ScrollEvent(ScrollEvent.SCROLL);
Expand Down

0 comments on commit 291f9b6

Please sign in to comment.