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/08/08 17:01:21 UTC

[1/4] git commit: [flex-asjs] [refs/heads/develop] - fix keyboard events for TLFEditTestFlexJS

Repository: flex-asjs
Updated Branches:
  refs/heads/develop 574faa160 -> 2b2c10092


fix keyboard events for TLFEditTestFlexJS


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/2b2c1009
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/2b2c1009
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/2b2c1009

Branch: refs/heads/develop
Commit: 2b2c10092ab0cac0c6f8cee2dac231f789f8e13f
Parents: 367f8b9
Author: Alex Harui <ah...@apache.org>
Authored: Tue Aug 8 10:01:04 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Aug 8 10:01:16 2017 -0700

----------------------------------------------------------------------
 .../textLayout/beads/DispatchTLFKeyboardEventBead.as   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2b2c1009/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 c308f9d..a671239 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
@@ -25,7 +25,8 @@ package org.apache.flex.textLayout.beads
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.events.KeyboardEvent;
-	import org.apache.flex.events.utils.KeyboardEventConverter;
+	import org.apache.flex.events.utils.EditingKeys;
+    import org.apache.flex.events.utils.KeyboardEventConverter;
 	import org.apache.flex.text.events.TextEvent;
 	import org.apache.flex.textLayout.events.FocusEvent;
 
@@ -202,12 +203,16 @@ package org.apache.flex.textLayout.beads
 			}
 		}
 		
+        private var inKeyEventHandler:Boolean;
+        
 		/**
 		 * @private
 		 */
 		COMPILE::JS
 		protected function keyEventHandler(event:KeyboardEvent):void
 		{
+            if (inKeyEventHandler) return;
+            inKeyEventHandler = true;
 			event.stopImmediatePropagation();
 			var newEvent:org.apache.flex.events.KeyboardEvent = KeyboardEventConverter.convert(event);
 			(_strand as IEventDispatcher).dispatchEvent(newEvent);
@@ -217,6 +222,10 @@ package org.apache.flex.textLayout.beads
 			}
 			if (event.type == "keypress")
 			{
+                // don't send along a TextInput event for "Backspace".  It should get handled
+                // in keyDownHandler
+                if (event.key == EditingKeys.BACKSPACE)
+                    return;
 				var textEvent:org.apache.flex.text.events.TextEvent = new org.apache.flex.text.events.TextEvent(TextEvent.TEXT_INPUT);
 				if (event.key != null)
 					textEvent.text = event.key;
@@ -226,7 +235,7 @@ package org.apache.flex.textLayout.beads
 					textEvent.text = String.fromCharCode(event['keyCode']);
 				(_strand as IEventDispatcher).dispatchEvent(textEvent);
 			}
-
+            inKeyEventHandler = false;
 		}
 
 		/**


[3/4] git commit: [flex-asjs] [refs/heads/develop] - change coordinate space to something expected but different from the way Flash textLine works

Posted by ah...@apache.org.
change coordinate space to something expected but different from the way Flash textLine works


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/367f8b97
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/367f8b97
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/367f8b97

Branch: refs/heads/develop
Commit: 367f8b9793641cbc43d88c4bb8184d136b5a3d09
Parents: 3bb3f41
Author: Alex Harui <ah...@apache.org>
Authored: Tue Aug 8 10:00:20 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Aug 8 10:01:16 2017 -0700

----------------------------------------------------------------------
 .../Text/src/main/flex/org/apache/flex/text/html/TextLine.as     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/367f8b97/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
index 440ae30..c260c0c 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/html/TextLine.as
@@ -356,7 +356,7 @@ package org.apache.flex.text.html
 				if (atomIndex == element.firstChild.textContent.length - 1)
 				{
 					w = (element.firstChild as HTMLElement).getClientRects()[0].width;
-					return new Rectangle(w, 1.2 - _textBlock.content.elementFormat.fontSize, 3, 1.2);
+					return new Rectangle(w, 1.2, 3, 1.2 + _textBlock.content.elementFormat.fontSize);
 				}
 				else
 				{
@@ -372,7 +372,7 @@ package org.apache.flex.text.html
                     span.innerHTML = s.substring(0, atomIndex + 1);
                     w = span.getClientRects()[0].width;
 					element.removeChild(span);
-					return new Rectangle(w1, 1.2 - _textBlock.content.elementFormat.fontSize, w - w1, 1.2);
+					return new Rectangle(w1, 1.2, w - w1, 1.2 + _textBlock.content.elementFormat.fontSize);
 				}
 			}
 		}


[4/4] git commit: [flex-asjs] [refs/heads/develop] - TLFEditor needs StandardTLFFactory

Posted by ah...@apache.org.
TLFEditor needs StandardTLFFactory


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/9decbb65
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/9decbb65
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/9decbb65

Branch: refs/heads/develop
Commit: 9decbb65f7fcb4ab3425700ab6e8d311b05948c6
Parents: 574faa1
Author: Alex Harui <ah...@apache.org>
Authored: Tue Aug 8 09:59:13 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Aug 8 10:01:16 2017 -0700

----------------------------------------------------------------------
 frameworks/projects/TLF/src/main/flex/TLFClasses.as | 1 +
 manualtests/TLFEditTestFlexJS/src/TLFEditor.as      | 4 ++++
 2 files changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9decbb65/frameworks/projects/TLF/src/main/flex/TLFClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/TLFClasses.as b/frameworks/projects/TLF/src/main/flex/TLFClasses.as
index 29f9d14..6321c18 100644
--- a/frameworks/projects/TLF/src/main/flex/TLFClasses.as
+++ b/frameworks/projects/TLF/src/main/flex/TLFClasses.as
@@ -111,6 +111,7 @@ package
 		import org.apache.flex.textLayout.events.TextLayoutEvent; TextLayoutEvent;
 		
 		import org.apache.flex.textLayout.factory.TextLineFactoryBase; TextLineFactoryBase;
+        import org.apache.flex.textLayout.factory.StandardTLFFactory; StandardTLFFactory;
 		import org.apache.flex.textLayout.factory.StringTextLineFactory; StringTextLineFactory;
 		import org.apache.flex.textLayout.factory.TextFlowTextLineFactory; TextFlowTextLineFactory;
 		import org.apache.flex.textLayout.factory.TruncationOptions; TruncationOptions;		

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9decbb65/manualtests/TLFEditTestFlexJS/src/TLFEditor.as
----------------------------------------------------------------------
diff --git a/manualtests/TLFEditTestFlexJS/src/TLFEditor.as b/manualtests/TLFEditTestFlexJS/src/TLFEditor.as
index fc6ad76..8052a58 100644
--- a/manualtests/TLFEditTestFlexJS/src/TLFEditor.as
+++ b/manualtests/TLFEditTestFlexJS/src/TLFEditor.as
@@ -30,6 +30,8 @@ import flash.utils.setTimeout;
 
 import org.apache.flex.textLayout.beads.DispatchTLFKeyboardEventBead;
 import org.apache.flex.textLayout.container.TextContainerManager;
+import org.apache.flex.textLayout.factory.TLFFactory;
+import org.apache.flex.textLayout.factory.StandardTLFFactory;
 import org.apache.flex.textLayout.edit.EditingMode;
 import org.apache.flex.textLayout.edit.ISelectionManager;
 import org.apache.flex.textLayout.edit.SelectionFormat;
@@ -57,6 +59,8 @@ public class TLFEditor extends UIBase
 	
 	public function TLFEditor()
 	{
+        TLFFactory.defaultTLFFactory = new StandardTLFFactory();
+        
 		// Create the TLF TextContainerManager, using this component
 		// as the DisplayObjectContainer for its TextLines.
 		// This TextContainerManager instance persists for the lifetime


[2/4] git commit: [flex-asjs] [refs/heads/develop] - guess at a size if no fontloader

Posted by ah...@apache.org.
guess at a size if no fontloader


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/3bb3f41a
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/3bb3f41a
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/3bb3f41a

Branch: refs/heads/develop
Commit: 3bb3f41a1f05e68c7caad86204a3b10c02dc6678
Parents: 9decbb6
Author: Alex Harui <ah...@apache.org>
Authored: Tue Aug 8 09:59:38 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Aug 8 10:01:16 2017 -0700

----------------------------------------------------------------------
 .../flex/org/apache/flex/text/engine/ElementFormat.as     | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3bb3f41a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
index 00a5c82..47e9bb2 100644
--- a/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
+++ b/frameworks/projects/Text/src/main/flex/org/apache/flex/text/engine/ElementFormat.as
@@ -86,7 +86,15 @@ package org.apache.flex.text.engine
 		public function getFontMetrics():FontMetrics
 		{
 			assert(fontDescription != null,"fontDescription not assigned!");
-			return fontDescription.fontLoader.getFont(fontDescription.fontName,fontDescription.fontStyle).fontMetrics.clone();
+            if (fontDescription.fontLoader)
+    			return fontDescription.fontLoader.getFont(fontDescription.fontName,fontDescription.fontStyle).fontMetrics.clone();
+            else
+            {
+                var fm:FontMetrics = new FontMetrics();
+                // just a guess for now
+                fm.emBox = new Rectangle(0, 1.2 - fontSize, fontSize, 1.2);
+                return fm;                
+            }
 		}
 	}
 }
\ No newline at end of file