You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2017/05/08 18:59:29 UTC
[17/21] git commit: [flex-asjs] [refs/heads/tlf] - hook up focus
events
hook up focus events
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/824e578e
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/824e578e
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/824e578e
Branch: refs/heads/tlf
Commit: 824e578eea60c974b5cf79aefb96bd101783b839
Parents: fd2304d
Author: Alex Harui <ah...@apache.org>
Authored: Mon May 8 11:05:59 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon May 8 11:59:03 2017 -0700
----------------------------------------------------------------------
.../beads/DispatchTLFKeyboardEventBead.as | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/824e578e/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
index 7abd04f..28daf46 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/beads/DispatchTLFKeyboardEventBead.as
@@ -89,6 +89,8 @@ package org.apache.flex.textLayout.beads
{
(_strand as Object).element.addEventListener('keydown', keyEventHandler);
(_strand as Object).element.addEventListener('keyup', keyEventHandler);
+ (_strand as Object).element.addEventListener('focus', focusEventHandler);
+ (_strand as Object).element.addEventListener('blur', focusEventHandler);
}
}
@@ -207,6 +209,21 @@ package org.apache.flex.textLayout.beads
event.preventDefault();
}
}
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ protected function focusEventHandler(event:FocusEvent):void
+ {
+ event.stopImmediatePropagation();
+ var newEvent:org.apache.flex.textLayout.events.FocusEvent = new org.apache.flex.textLayout.events.FocusEvent(event.type == "focus" ? "focusIn" : "focusOut");
+ (_strand as IEventDispatcher).dispatchEvent(newEvent);
+ if(newEvent.defaultPrevented)
+ {
+ event.preventDefault();
+ }
+ }
}
}