something something ui
This commit is contained in:
26
src/lib/ui/elements/EventMap.hx
Normal file
26
src/lib/ui/elements/EventMap.hx
Normal 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});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user