flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [8/8] git commit: [flex-asjs] [refs/heads/tlf] - stop using buttonDown. Supposedly unreliable in browsers for mouseMove. Instead track buttonDown via mouseDown and mouseUp. Probably need to capture mouseup on other targets someday
Date Sat, 17 Jun 2017 05:08:19 GMT
stop using buttonDown.  Supposedly unreliable in browsers for mouseMove.  Instead track buttonDown
via mouseDown and mouseUp.  Probably need to capture mouseup on other targets someday


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

Branch: refs/heads/tlf
Commit: ef940e3f414ac6b2777287ad40302dac2cd53fec
Parents: 1677f0a
Author: Alex Harui <aharui@apache.org>
Authored: Fri Jun 16 22:08:08 2017 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Jun 16 22:08:45 2017 -0700

----------------------------------------------------------------------
 .../textLayout/container/ContainerController.as | 26 +++++++++++---------
 .../container/TextContainerManager.as           | 10 ++++++--
 .../flex/textLayout/edit/SelectionManager.as    |  9 ++++++-
 .../flex/textLayout/elements/LinkElement.as     |  8 ++++--
 .../events/FlowElementMouseEventManager.as      | 13 +++++++---
 5 files changed, 46 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef940e3f/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
index 047d497..e6ed682 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/ContainerController.as
@@ -18,14 +18,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.textLayout.container 
 {
-	import org.apache.flex.textLayout.elements.GlobalSettings;
-	import org.apache.flex.textLayout.elements.IInlineGraphicElement;
-	import org.apache.flex.textLayout.compose.ITextFlowTableBlock;
-	import org.apache.flex.textLayout.elements.ITableRowElement;
-	import org.apache.flex.textLayout.utils.CreateTLFUtil;
-	import org.apache.flex.textLayout.elements.ITableCellElement;
-	import org.apache.flex.textLayout.elements.IParagraphElement;
-	import org.apache.flex.textLayout.elements.IFlowLeafElement;
 	import org.apache.flex.core.IChild;
 	import org.apache.flex.core.IParentIUIBase;
 	import org.apache.flex.core.IUIBase;
@@ -47,6 +39,7 @@ package org.apache.flex.textLayout.container
 	import org.apache.flex.textLayout.compose.FlowDamageType;
 	import org.apache.flex.textLayout.compose.IFlowComposer;
 	import org.apache.flex.textLayout.compose.ITextFlowLine;
+	import org.apache.flex.textLayout.compose.ITextFlowTableBlock;
 	import org.apache.flex.textLayout.compose.TextLineRecycler;
 	import org.apache.flex.textLayout.debug.Debugging;
 	import org.apache.flex.textLayout.debug.assert;
@@ -56,11 +49,17 @@ package org.apache.flex.textLayout.container
 	import org.apache.flex.textLayout.edit.IInteractionEventHandler;
 	import org.apache.flex.textLayout.edit.ISelectionManager;
 	import org.apache.flex.textLayout.edit.SelectionFormat;
-	import org.apache.flex.textLayout.elements.IBackgroundManager;
 	import org.apache.flex.textLayout.elements.CellCoordinates;
+	import org.apache.flex.textLayout.elements.GlobalSettings;
+	import org.apache.flex.textLayout.elements.IBackgroundManager;
 	import org.apache.flex.textLayout.elements.IContainerFormattedElement;
-	import org.apache.flex.textLayout.elements.TableBlockContainer;
+	import org.apache.flex.textLayout.elements.IFlowLeafElement;
+	import org.apache.flex.textLayout.elements.IInlineGraphicElement;
+	import org.apache.flex.textLayout.elements.IParagraphElement;
+	import org.apache.flex.textLayout.elements.ITableCellElement;
+	import org.apache.flex.textLayout.elements.ITableRowElement;
 	import org.apache.flex.textLayout.elements.ITextFlow;
+	import org.apache.flex.textLayout.elements.TableBlockContainer;
 	import org.apache.flex.textLayout.events.ActivateEvent;
 	import org.apache.flex.textLayout.events.ContextMenuEvent;
 	import org.apache.flex.textLayout.events.EditEvent;
@@ -78,7 +77,7 @@ package org.apache.flex.textLayout.container
 	import org.apache.flex.textLayout.formats.ITextLayoutFormat;
 	import org.apache.flex.textLayout.formats.TextLayoutFormat;
 	import org.apache.flex.textLayout.formats.TextLayoutFormatBase;
-
+	import org.apache.flex.textLayout.utils.CreateTLFUtil;
 	import org.apache.flex.textLayout.utils.Twips;
 	import org.apache.flex.utils.DisplayUtils;
 	import org.apache.flex.utils.ObjectMap;
@@ -121,6 +120,7 @@ package org.apache.flex.textLayout.container
 		
 		private var _container:IParentIUIBase;
 		private var _mouseEventManager:FlowElementMouseEventManager;
+        private var buttonDown:Boolean;
 		
 		// note must be protected - subclass sets or gets this variable but can't be public
 		/** computed container attributes.  @private */
@@ -2175,6 +2175,7 @@ package org.apache.flex.textLayout.container
 		/** @private Does required mouseDown handling.  Calls mouseDownHandler.  @see #mouseDownHandler
*/
 		public function requiredMouseDownHandler(event:MouseEvent):void
 		{
+            buttonDown = true;
 			if (!_selectListenersAttached)
 			{
 				var containerRoot:IEventDispatcher = getContainerRoot();
@@ -2215,6 +2216,7 @@ package org.apache.flex.textLayout.container
 		/** @private */
 		public function rootMouseUpHandler(event:MouseEvent):void
 		{
+            buttonDown = false;
 			clearSelectHandlers();
 			getInteractionHandler().mouseUpHandler(event);
 		}
@@ -2327,7 +2329,7 @@ package org.apache.flex.textLayout.container
 			{
 //TODO fix this
 				// only autoscroll if we haven't hit something on the stage related to this particular
TextFlow
-				if (event.buttonDown && !hitOnMyFlowExceptLastContainer(event))
+				if (buttonDown && !hitOnMyFlowExceptLastContainer(event))
 					// autoScrollIfNecessary(event.stageX, event.stageY);
 				interactionManager.mouseMoveHandler(event);
 			}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef940e3f/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
index 457dd88..77c7cb8 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/container/TextContainerManager.as
@@ -2525,8 +2525,14 @@ class RemappedMouseEvent extends org.apache.flex.events.MouseEvent
 			containerPoint = new Point();
 
 		/* event.commandKey,event.controlKey,event.clickCount are also supported in AIR.  IMHO
they are a nonissue for the initial click */
-		super(event.type,event.bubbles,event.cancelable,containerPoint.x,containerPoint.y,event.relatedObject,event.ctrlKey,event.altKey,event.shiftKey,event.buttonDown,event.delta);
-		
+        COMPILE::SWF
+        {
+    		super(event.type,event.bubbles,event.cancelable,containerPoint.x,containerPoint.y,event.relatedObject,event.ctrlKey,event.altKey,event.shiftKey,event.buttonDown,event.delta);
+        }
+        COMPILE::JS
+        {
+            super(event.type,event.bubbles,event.cancelable,containerPoint.x,containerPoint.y,event.relatedObject,event.ctrlKey,event.altKey,event.shiftKey,false,event.delta);
       
+        }
 		_event = event;
 	}
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef940e3f/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
index 5fdc97f..6a9d11c 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/SelectionManager.as
@@ -1976,6 +1976,9 @@ package org.apache.flex.textLayout.edit
 		// ///////////////////////////////////
 		// Mouse and keyboard methods
 		// ///////////////////////////////////
+        
+        private var buttonDown:Boolean;
+        
 		/** 
 		 *  @copy IInteractionEventHandler#mouseDownHandler()
 		 * 
@@ -1986,6 +1989,8 @@ package org.apache.flex.textLayout.edit
 		 */
 		public function mouseDownHandler(event:MouseEvent):void
 		{
+            buttonDown = true;
+            
 			if (subManager)
 				subManager.selectRange(-1, -1);
 
@@ -2047,7 +2052,7 @@ package org.apache.flex.textLayout.edit
 				setMouseCursor(MouseCursor.IBEAM);
 			}
 
-			if (event.buttonDown)
+			if (buttonDown)
 			{
 				var cell:ITableCellElement = _textFlow.parentElement as ITableCellElement;
 
@@ -2109,6 +2114,8 @@ package org.apache.flex.textLayout.edit
 		 */
 		public function mouseUpHandler(event:MouseEvent):void
 		{
+            buttonDown = false;
+            
 			if (!_mouseOverSelectionArea)
 			{
 				setMouseCursor(MouseCursor.AUTO);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef940e3f/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/LinkElement.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/LinkElement.as
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/LinkElement.as
index 72cc6ca..6cfdb84 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/LinkElement.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/elements/LinkElement.as
@@ -496,12 +496,15 @@ package org.apache.flex.textLayout.elements
 			}
 		}
 
+        private var buttonDown:Boolean;
+        
 		/** @private
 		 * The ElementMouseEventManager calls this method directly. Note that the mouse
 		 * coordinates are unrelated to any coordinate in the container or this element.
 		 */
 		public function mouseDownHandler(mgr:FlowElementMouseEventManager, evt:MouseEvent):void
 		{
+            buttonDown = true;
 			mgr.setHandCursor(true);
 			setToState(LinkState.ACTIVE);
 			evt.stopImmediatePropagation();
@@ -514,7 +517,7 @@ package org.apache.flex.textLayout.elements
 		public function mouseMoveHandler(mgr:FlowElementMouseEventManager, evt:MouseEvent):void
 		{
 			mgr.setHandCursor(true);
-			setToState(evt.buttonDown ? LinkState.ACTIVE : LinkState.HOVER);
+			setToState(buttonDown ? LinkState.ACTIVE : LinkState.HOVER);
 		}
 
 		/** @private
@@ -534,7 +537,7 @@ package org.apache.flex.textLayout.elements
 		public function mouseOverHandler(mgr:FlowElementMouseEventManager, evt:MouseEvent):void
 		{
 			mgr.setHandCursor(true);
-			setToState(evt.buttonDown ? LinkState.ACTIVE : LinkState.HOVER);
+			setToState(buttonDown ? LinkState.ACTIVE : LinkState.HOVER);
 		}
 
 		/** @private
@@ -543,6 +546,7 @@ package org.apache.flex.textLayout.elements
 		 */
 		public function mouseUpHandler(mgr:FlowElementMouseEventManager, evt:MouseEvent):void
 		{
+            buttonDown = false;
 			mgr.setHandCursor(true);
 			setToState(LinkState.HOVER);
 			evt.stopImmediatePropagation();

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef940e3f/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as
index ffa16e5..7c53953 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEventManager.as
@@ -28,10 +28,10 @@ package org.apache.flex.textLayout.events
 	import org.apache.flex.textLayout.container.IContainerController;
 	import org.apache.flex.textLayout.container.ScrollPolicy;
 	import org.apache.flex.textLayout.debug.assert;
-	import org.apache.flex.textLayout.elements.IFlowGroupElement;
 	import org.apache.flex.textLayout.elements.IFlowElement;
-	import org.apache.flex.textLayout.elements.ITextFlow;
+	import org.apache.flex.textLayout.elements.IFlowGroupElement;
 	import org.apache.flex.textLayout.elements.ILinkElement;
+	import org.apache.flex.textLayout.elements.ITextFlow;
 	import org.apache.flex.textLayout.elements.TextRange;
 	import org.apache.flex.textLayout.formats.BlockProgression;
 	import org.apache.flex.textLayout.utils.GeometryUtil;
@@ -524,6 +524,8 @@ package org.apache.flex.textLayout.events
 				link.mouseOutHandler(this, _lastMouseEvent);
 		}
 		
+        private var buttonDown:Boolean;
+        
 		/** @private
 		 * Process mouse events.
 		 * 
@@ -536,6 +538,11 @@ package org.apache.flex.textLayout.events
 			if (!_hitTests)
 				return;
 			
+            if (evt.type == MouseEvent.MOUSE_DOWN)
+                buttonDown = true;
+            else if (evt.type == MouseEvent.MOUSE_UP)
+                buttonDown = false;
+            
 			// note that mouseOver and mouseOut are used for hit-testing only
 			// need the last mouse event's button state to pass in to LinkElement
 			// in case the state of the Ctrl key changes (see hitTestKeyEventHandler())
@@ -549,7 +556,7 @@ package org.apache.flex.textLayout.events
 				if (_currentElement)
 					// generate a mouseOut event
 					localDispatchEvent(FlowElementMouseEvent.ROLL_OUT, evt);
-				else if (evt.buttonDown)
+				else if (buttonDown)
 					// do not interact if the button is down to not disturb e.g. 
 					// a mark operation in the container
 					_blockInteraction = true;


Mime
View raw message