Skip to content

Commit

Permalink
Revert "better focus management"
Browse files Browse the repository at this point in the history
This reverts commit dfb4bf5.
  • Loading branch information
ianharrigan committed Mar 18, 2024
1 parent ac9aaab commit b58b3dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 43 deletions.
3 changes: 0 additions & 3 deletions haxe/ui/containers/ScrollView.hx
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ private class EnsureVisible extends DefaultBehaviour {
var scrollRect = new Rectangle(scrollview.screenLeft, scrollview.screenTop, scrollview.width, scrollview.height);

var scrollRectFixed = scrollRect.copy();
if (scrollview.layout == null) {
scrollview.validateNow();
}
var usableSize = scrollview.layout.usableSize;
scrollRectFixed.width = usableSize.width;
scrollRectFixed.height = usableSize.height;
Expand Down
47 changes: 7 additions & 40 deletions haxe/ui/focus/FocusManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package haxe.ui.focus;

import haxe.ui.backend.FocusManagerImpl;
import haxe.ui.core.Component;
import haxe.ui.core.IScroller;
import haxe.ui.core.Screen;
import haxe.ui.events.MouseEvent;
import haxe.ui.events.UIEvent;
Expand Down Expand Up @@ -41,30 +40,10 @@ class FocusManager extends FocusManagerImpl {
}

private function onScreenMouseDown(event:MouseEvent) {
if (!enabled) {
return;
}

var list = Screen.instance.findComponentsUnderPoint(event.screenX, event.screenY);
list.reverse();
for (l in list) {
if (l.disabled || l.hidden || @:privateAccess l._isDisposed) {
continue;
}
if (isOfType(l, IFocusable)) {
var focusable:IFocusable = cast l;
if (focusable.allowFocus) {
if (isOfType(l, IScroller)) {
var scroller:IScroller = cast l;
if (scroller.isScrollable) {
focus = focusable;
return;
}
} else {
focus = focusable;
return;
}
}
return;
}
}

Expand Down Expand Up @@ -214,30 +193,18 @@ class FocusManager extends FocusManagerImpl {
if (c.hidden == true) {
return null;
}

if ((c is IFocusable)) {
var f:IFocusable = cast c;
if (considerAutoFocus == true && f.autoFocus == false) {
return null;
}
if (f.allowFocus == true && f.disabled == false) {
if (isOfType(c, IScroller)) {
var scroller:IScroller = cast c;
if (scroller.isScrollable) {
if (f.focus == true) {
currentFocus = f;
}
if (list != null) {
list.push(f);
}
}
} else {
if (f.focus == true) {
currentFocus = f;
}
if (list != null) {
list.push(f);
}
if (f.focus == true) {
currentFocus = f;
}
if (list != null) {
list.push(f);
}
}
}
Expand Down

0 comments on commit b58b3dd

Please sign in to comment.