diff --git a/src/main/haxework/view/form/ButtonView.hx b/src/main/haxework/view/form/ButtonView.hx index 195d34f..551958c 100755 --- a/src/main/haxework/view/form/ButtonView.hx +++ b/src/main/haxework/view/form/ButtonView.hx @@ -18,6 +18,7 @@ class ButtonView extends LabelView { public var disabled(default, set):Bool; public var state(get, null):ButtonState; public var onPress(default, null):Signal; + public var propagation(default, default):Bool; private var overed:Bool; private var downed:Bool; @@ -26,6 +27,7 @@ class ButtonView extends LabelView { super(); skin = new ButtonColorSkin(); style = "button"; + propagation = true; overed = false; downed = false; state = ButtonState.UP; @@ -47,7 +49,7 @@ class ButtonView extends LabelView { private function onMouseClick(event:MouseEvent):Void { #if js if (downed) { #end - //event.stopImmediatePropagation(); + if (!propagation) event.stopImmediatePropagation(); if (!disabled) onPress.emit(this); #if js } #end } diff --git a/src/main/haxework/view/frame/FrameSwitcher.hx b/src/main/haxework/view/frame/FrameSwitcher.hx index 9a50aa6..9b5de2b 100755 --- a/src/main/haxework/view/frame/FrameSwitcher.hx +++ b/src/main/haxework/view/frame/FrameSwitcher.hx @@ -17,11 +17,13 @@ class FrameSwitcher extends GroupView { public var animateFactory(default, default):Class; private var animate:IAnimate; + private var history:Array<{id:String, data:Dynamic}>; public function new() { super(); factory = new Map(); frames = new Map(); + history = []; current = null; } @@ -65,16 +67,23 @@ class FrameSwitcher extends GroupView { } animate = buildAnimate(current); if (animate != null && prev != null) { - animate.start(function(_) { - removePrev(prev); - }); + animate.start(function(_) removePrev(prev)); } else { removePrev(prev); } + history.push({id:current.frameId, data:data}); onSwitch.emit(current); return cast current; } + public function back():Void { + if (history.length > 1) { + history.pop(); + var item = history.pop(); + change(item.id, item.data); + } + } + private function removePrev(prev:Null>):Void { if (prev != null) { prev.onHide();