lib/cyberarm_engine/ui/event.rb in cyberarm_engine-0.18.0 vs lib/cyberarm_engine/ui/event.rb in cyberarm_engine-0.19.0
- old
+ new
@@ -13,14 +13,21 @@
def publish(event, *args)
raise ArgumentError, "#{self.class} does not handle #{event.inspect}" unless @event_handler.include?(event)
return unless enabled?
- return :handled if respond_to?(event) && (send(event, self, *args) == :handled)
+ was_handled = false
+ was_handled = true if respond_to?(event) && (send(event, self, *args) == :handled)
+
@event_handler[event].reverse_each do |handler|
- return :handled if handler.call(self, *args) == :handled
+ if handler.call(self, *args) == :handled
+ was_handled = true
+ break
+ end
end
+
+ return :handled if was_handled
parent.publish(event, *args) if parent
nil
end