improved reactive ui and events
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package lib.ui.reactive;
|
||||
|
||||
import kernel.Log;
|
||||
import kernel.ButtonType;
|
||||
import util.Vec.Vec2;
|
||||
|
||||
using tink.CoreApi;
|
||||
@@ -10,11 +8,12 @@ abstract class UIElement {
|
||||
abstract public function render(bounds:Vec2<Int>):Canvas;
|
||||
public var changed(default, null):Signal<Noise>;
|
||||
private final changedTrigger:SignalTrigger<Noise> = Signal.trigger();
|
||||
public final eventListner:UIEvents = {};
|
||||
|
||||
public function new() {
|
||||
public function new(events: UIEvents = null) {
|
||||
changed = changedTrigger.asSignal();
|
||||
}
|
||||
|
||||
public function handleClickEvent(pos: Vec2<Int>,button: ButtonType):Void {
|
||||
if (events != null){
|
||||
this.eventListner = events;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user