something something ui

This commit is contained in:
2023-02-05 02:56:04 +01:00
parent 3e7d993662
commit a4e4e103bd
8 changed files with 197 additions and 19 deletions

View File

@@ -0,0 +1,26 @@
package lib.ui.elements;
import lib.ui.rendere.UIEventDelegate;
abstract EventMap(List<{bound:Rect, delegate:UIEventDelegate}>) {
inline public function new(?i:List<{bound:Rect, delegate:UIEventDelegate}>) {
if (i == null) {
this = new List<{bound:Rect, delegate:UIEventDelegate}>();
} else {
this = i;
}
}
public function findResponseableDelegate(pos:Pos):UIEventDelegate {
for (i in this) {
if (i.bound.isInside(pos)) {
return i.delegate;
}
}
return null;
}
public function addElement(element:UIEventDelegate, bound:Rect) {
this.add({bound: bound, delegate: element});
}
}