You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ma...@apache.org on 2013/11/22 11:30:09 UTC
[1/3] git commit: [flex-sdk] [refs/heads/develop] - UPDATE FLEX-33166
Mobile TextInput with native StageTextInput cannot be included in scrollable
forms - prevent touch scrolling from being initiated in a TextInput
Updated Branches:
refs/heads/develop c1b8214bc -> 1bb2964be
UPDATE FLEX-33166 Mobile TextInput with native StageTextInput cannot be included in scrollable forms
- prevent touch scrolling from being initiated in a TextInput
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/dba8dd37
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/dba8dd37
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/dba8dd37
Branch: refs/heads/develop
Commit: dba8dd37b83976309f8b62e23c2d563e5f86018c
Parents: dc4ebc0
Author: mamsellem <ma...@systar.com>
Authored: Fri Nov 22 09:52:55 2013 +0100
Committer: mamsellem <ma...@systar.com>
Committed: Fri Nov 22 09:52:55 2013 +0100
----------------------------------------------------------------------
.../supportClasses/SkinnableTextBase.as | 37 ++++++++------------
1 file changed, 14 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dba8dd37/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as b/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as
index 7f4a29d..d43ca69 100644
--- a/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as
+++ b/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as
@@ -516,7 +516,7 @@ public class SkinnableTextBase extends SkinnableComponent
* The IEditableText that may be present
* in any skin assigned to this component.
* This is RichEditableText for the Spark theme
- * and StyleableStageText for the Mobile theme.
+ * and StyleableStageText/ScrollableStageText for the Mobile theme.
*
* @langversion 3.0
* @playerversion Flash 10
@@ -1719,15 +1719,15 @@ public class SkinnableTextBase extends SkinnableComponent
if (getStyle("interactionMode") == InteractionMode.TOUCH && !touchHandlersAdded)
{
addEventListener(MouseEvent.MOUSE_DOWN, touchMouseDownHandler);
- addEventListener(TouchInteractionEvent.TOUCH_INTERACTION_START,
- touchInteractionStartHandler);
+ addEventListener(TouchInteractionEvent.TOUCH_INTERACTION_STARTING,
+ touchInteractionStartingHandler);
touchHandlersAdded = true;
}
else if (getStyle("interactionMode") == InteractionMode.MOUSE && touchHandlersAdded)
{
removeEventListener(MouseEvent.MOUSE_DOWN, touchMouseDownHandler);
- removeEventListener(TouchInteractionEvent.TOUCH_INTERACTION_START,
- touchInteractionStartHandler);
+ removeEventListener(TouchInteractionEvent.TOUCH_INTERACTION_STARTING,
+ touchInteractionStartingHandler);
touchHandlersAdded = false;
}
}
@@ -2606,23 +2606,23 @@ public class SkinnableTextBase extends SkinnableComponent
*/
private function touchMouseUpHandler(event:Event):void
{
- /*
- We set the focus on the component on mouseUp to activate the softKeyboard
+ /*
+ We set the focus on the component on mouseUp to activate the softKeyboard
We only set focus if the following conditions are met:
1. mouseUp occurs on this component
2. mouseDown occured on any subcomponent besides the textDisplay OR
mouseDown occurred on textDisplay and mouseUp did not occur on textDisplay
-
+
The mouseDown and mouseUp on textDisplay case is handled by the Player
- */
- if ((event.target is DisplayObject && contains(DisplayObject(event.target)))
+ */
+ if ((event.target is DisplayObject && contains(DisplayObject(event.target)))
&& (delaySetFocus ||
(mouseDownTarget == textDisplay && event.target != textDisplay)))
{
if (textDisplay)
textDisplay.setFocus();
}
-
+
clearMouseDownState();
}
@@ -2630,19 +2630,10 @@ public class SkinnableTextBase extends SkinnableComponent
* @private
* Called if we are inside of a Scroller and the user has started a scroll gesture
*/
- private function touchInteractionStartHandler(event:TouchInteractionEvent):void
+ private function touchInteractionStartingHandler(event:TouchInteractionEvent):void
{
- // if in iOS and keyboard is up and scrolling is occurring, drop the keyboard
- var topLevelApp:Application = FlexGlobals.topLevelApplication as Application;
- if (isIOS && topLevelApp && topLevelApp.isSoftKeyboardActive && editable)
- {
- // set focus
- stage.focus = null;
- }
-
- // Clear out the state because starting a scroll gesture should never
- // open the soft keyboard
- clearMouseDownState();
+ // don't allow initiating scrolling from a TextInput on mobile anymore
+ event.preventDefault();
}
/**
[3/3] git commit: [flex-sdk] [refs/heads/develop] - Merge branch
'develop' of https://git-wip-us.apache.org/repos/asf/flex-sdk into develop
Posted by ma...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-sdk into develop
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/1bb2964b
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/1bb2964b
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/1bb2964b
Branch: refs/heads/develop
Commit: 1bb2964be1d4323ea679266dd0590f3d30f8e0df
Parents: 9e4bf21 c1b8214
Author: mamsellem <ma...@systar.com>
Authored: Fri Nov 22 11:26:38 2013 +0100
Committer: mamsellem <ma...@systar.com>
Committed: Fri Nov 22 11:26:38 2013 +0100
----------------------------------------------------------------------
frameworks/projects/spark/src/spark/components/ComboBox.as | 2 +-
.../projects/spark/src/spark/components/supportClasses/ListBase.as | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[2/3] git commit: [flex-sdk] [refs/heads/develop] - FIX FLEX-33166
Mobile TextInput with native StageTextInput cannot be included in scrollable
forms - fix issue when tapping in the padding area of a text input - fix
issue when tapping several times in
Posted by ma...@apache.org.
FIX FLEX-33166 Mobile TextInput with native StageTextInput cannot be included in scrollable forms
- fix issue when tapping in the padding area of a text input
- fix issue when tapping several times in and out of text inputs (rep. Collins Childs)
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/9e4bf21f
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/9e4bf21f
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/9e4bf21f
Branch: refs/heads/develop
Commit: 9e4bf21f9dc8815d67c192f2cea65e2636092c53
Parents: dba8dd3
Author: mamsellem <ma...@systar.com>
Authored: Fri Nov 22 11:26:06 2013 +0100
Committer: mamsellem <ma...@systar.com>
Committed: Fri Nov 22 11:26:06 2013 +0100
----------------------------------------------------------------------
.../supportClasses/ScrollableStageText.as | 163 +++++++++----------
.../skins/mobile/ScrollingStageTextAreaSkin.as | 22 +++
.../skins/mobile/ScrollingStageTextInputSkin.as | 22 +++
3 files changed, 118 insertions(+), 89 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/9e4bf21f/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ScrollableStageText.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ScrollableStageText.as b/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ScrollableStageText.as
index f14cc38..0c7e2cf 100644
--- a/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ScrollableStageText.as
+++ b/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ScrollableStageText.as
@@ -429,7 +429,6 @@ public class ScrollableStageText extends UIComponent implements IStyleableEdita
private var isEditing:Boolean = false;
private var invalidateProxyFlag:Boolean = false;
-
//--------------------------------------------------------------------------
//
// Properties
@@ -456,6 +455,9 @@ public class ScrollableStageText extends UIComponent implements IStyleableEdita
*/
protected var invalidateStyleFlag:Boolean = true;
+
+ private var _softKeyboardType: String = SoftKeyboardType.DEFAULT;
+
//--------------------------------------------------------------------------
//
// Properties
@@ -1137,10 +1139,6 @@ public class ScrollableStageText extends UIComponent implements IStyleableEdita
// softKeyboardType
//----------------------------------
- /**
- * Storage for the softKeyboardType property.
- */
- private var _softKeyboardType:String = SoftKeyboardType.DEFAULT;
/**
* @inheritDoc
@@ -1503,57 +1501,6 @@ public class ScrollableStageText extends UIComponent implements IStyleableEdita
}
- //--------------------------------------------------------------------------
- //
- // EDITING AND FOCUS MANAGEMENT
- //
- //--------------------------------------------------------------------------
-
- /**
- * @return true if editing was actually stated,, false is already started
- * */
- protected function startTextEdit():Boolean
- {
- if (!isEditing)
- {
- isEditing = true;
- proxy.visible = false;
- updateViewPort();
- stageText.visible = true;
- return true;
- }
- else {
- return false;
- }
- }
-
- /**
- * @return true if editing was actually ended, false is already ended
- * */
- protected function endTextEdit():Boolean
- {
- if (isEditing)
- {
- isEditing = false;
- invalidateProxy();
- proxy.visible = true;
- stageText.visible = false;
-
- if (focusManager is FocusManager)
- {
- var fm:FocusManager = focusManager as FocusManager;
- var lastFocus:Object = fm.lastFocus as Object;
-
- if (lastFocus && lastFocus.hasOwnProperty("textDisplay") && lastFocus.textDisplay == this)
- fm.lastFocus = null;
- }
- return true;
- }
- else {
- return false;
- }
- }
-
//--------------------------------------------------------------------------
// Proxy Management
//--------------------------------------------------------------------------
@@ -1778,13 +1725,6 @@ public class ScrollableStageText extends UIComponent implements IStyleableEdita
savedSelectionActiveIndex = 0;
}
-// if (deferredViewPortUpdate)
-// updateViewPort();
-
- // always create proxy image
-
- // register listeners
- addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
addEventListener(TouchInteractionEvent.TOUCH_INTERACTION_STARTING, touchStartingHandler);
if (stageText != null)
{
@@ -1810,9 +1750,7 @@ public class ScrollableStageText extends UIComponent implements IStyleableEdita
savedSelectionAnchorIndex = stageText.selectionAnchorIndex;
savedSelectionActiveIndex = stageText.selectionActiveIndex;
-
stageText.stage = null;
- removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
addEventListener(TouchInteractionEvent.TOUCH_INTERACTION_STARTING, touchStartingHandler);
stageText.removeEventListener(Event.CHANGE, stageText_changeHandler);
stageText.removeEventListener(Event.COMPLETE, stageText_completeHandler);
@@ -1837,18 +1775,6 @@ public class ScrollableStageText extends UIComponent implements IStyleableEdita
}
}
- private function mouseDownHandler(event:MouseEvent):void
- {
- setFocus();
- }
-
- private function touchStartingHandler(event:Event):void
- {
- // don't allow touch scrolling while editing (of the StageText will stay in place)
- if (isEditing)
- event.preventDefault();
- }
-
protected function stageText_changeHandler(event:Event):void
{
var foundChange:Boolean = false;
@@ -1872,29 +1798,41 @@ public class ScrollableStageText extends UIComponent implements IStyleableEdita
invalidateProperties();
}
+
+
+ private function touchStartingHandler(event: Event): void
+ {
+ // don't allow touch scrolling while editing (of the StageText will stay in place)
+ if (isEditing)
+ event.preventDefault();
+ }
+
private function stageText_focusInHandler(event:FocusEvent):void
{
- if (startTextEdit()){
+ if (!isEditing){
+ startTextEdit();
+ }
// Focus events are documented as bubbling. However, all events coming
// from StageText are set to not bubble. So we need to create an
// appropriate bubbling event here.
- dispatchEvent(new FocusEvent(event.type, true, event.cancelable,
- event.relatedObject, event.shiftKey, event.keyCode, event.direction));
- }
+ dispatchEvent(new FocusEvent(event.type, true, event.cancelable,
+ event.relatedObject, event.shiftKey, event.keyCode, event.direction));
}
private function stageText_focusOutHandler(event:FocusEvent):void
{
- if (endTextEdit()) {
- // Focus events are documented as bubbling. However, all events coming
- // from StageText are set to not bubble. So we need to create an
- // appropriate bubbling event here.
- dispatchEvent(new FocusEvent(event.type, true, event.cancelable,
- event.relatedObject, event.shiftKey, event.keyCode, event.direction));
+ if (isEditing)
+ {
+ endTextEdit();
}
-
+ // Focus events are documented as bubbling. However, all events coming
+ // from StageText are set to not bubble. So we need to create an
+ // appropriate bubbling event here.
+ dispatchEvent(new FocusEvent(event.type, true, event.cancelable,
+ event.relatedObject, event.shiftKey, event.keyCode, event.direction));
}
+
private function stageText_keyDownHandler(event:KeyboardEvent):void
{
// Taps on the Enter key on soft keyboards may send us the Next keycode
@@ -1945,12 +1883,59 @@ public class ScrollableStageText extends UIComponent implements IStyleableEdita
private function stageText_softKeyboardDeactivateHandler(event:SoftKeyboardEvent):void
{
- if (endTextEdit()) {
dispatchEvent(new SoftKeyboardEvent(event.type,
true, event.cancelable, this, event.triggerType));
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // EDITING
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @return true if editing was actually stated,, false is already started
+ * */
+ protected function startTextEdit(): Boolean
+ {
+ if (!isEditing)
+ {
+ // trace("start text edit:", debugId);
+ isEditing = true;
+ proxy.visible = false;
+ updateViewPort();
+ stageText.visible = true;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * @return true if editing was actually ended, false is already ended
+ * */
+ protected function endTextEdit(): Boolean
+ {
+ // if owning TextInput mouseDown is the cause of focus out, abort
+
+ if (isEditing)
+ {
+ // trace("end text edit:", debugId);
+ isEditing = false;
+ invalidateProxy();
+ proxy.visible = true;
+ stageText.visible = false;
+ return true;
+ }
+ else
+ {
+ return false;
}
}
+ /* debug */
protected function get debugId():String {
var parentSkin: UIComponent = this.parent.parent as UIComponent;
return parentSkin ? parentSkin.id : "-" ;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/9e4bf21f/frameworks/projects/mobiletheme/src/spark/skins/mobile/ScrollingStageTextAreaSkin.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/mobile/ScrollingStageTextAreaSkin.as b/frameworks/projects/mobiletheme/src/spark/skins/mobile/ScrollingStageTextAreaSkin.as
index bdf9edf..1990a4a 100644
--- a/frameworks/projects/mobiletheme/src/spark/skins/mobile/ScrollingStageTextAreaSkin.as
+++ b/frameworks/projects/mobiletheme/src/spark/skins/mobile/ScrollingStageTextAreaSkin.as
@@ -19,6 +19,9 @@
package spark.skins.mobile
{
+import flash.display.DisplayObjectContainer;
+import flash.events.MouseEvent;
+
import spark.components.supportClasses.IStyleableEditableText;
import spark.components.supportClasses.ScrollableStageText;
@@ -39,11 +42,30 @@ public class ScrollingStageTextAreaSkin extends StageTextAreaSkin
public function ScrollingStageTextAreaSkin()
{
super();
+ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
}
override protected function createTextDisplay():IStyleableEditableText
{
return new ScrollableStageText(multiline);
+
+ }
+
+ /** @private
+ * We have to force focus to the text display when user user in the padding area of the TextInput.
+ we do this hack in the skin instead of the hostComponent TextInput to not impact the behavior of other skins
+ */
+ override public function set owner(value: DisplayObjectContainer): void
+ {
+ super.owner = value;
+ if (owner){
+ owner.mouseEnabled = false;
+ }
+ }
+
+ private function mouseDownHandler(event: MouseEvent): void
+ {
+ textDisplay.setFocus();
}
}
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/9e4bf21f/frameworks/projects/mobiletheme/src/spark/skins/mobile/ScrollingStageTextInputSkin.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/mobile/ScrollingStageTextInputSkin.as b/frameworks/projects/mobiletheme/src/spark/skins/mobile/ScrollingStageTextInputSkin.as
index d856d53..61e37df 100644
--- a/frameworks/projects/mobiletheme/src/spark/skins/mobile/ScrollingStageTextInputSkin.as
+++ b/frameworks/projects/mobiletheme/src/spark/skins/mobile/ScrollingStageTextInputSkin.as
@@ -19,6 +19,9 @@
package spark.skins.mobile
{
+import flash.display.DisplayObjectContainer;
+import flash.events.MouseEvent;
+
import spark.components.supportClasses.IStyleableEditableText;
import spark.components.supportClasses.ScrollableStageText;
@@ -39,11 +42,30 @@ public class ScrollingStageTextInputSkin extends StageTextInputSkin
public function ScrollingStageTextInputSkin()
{
super();
+ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
}
override protected function createTextDisplay():IStyleableEditableText
{
return new ScrollableStageText(multiline);
+
+ }
+
+ /** @private
+ * We have to force focus to the text display when user user in the padding area of the TextInput.
+ we do this hack in the skin instead of the hostComponent TextInput to not impact the behavior of other skins
+ */
+ override public function set owner(value: DisplayObjectContainer): void
+ {
+ super.owner = value;
+ if (owner){
+ owner.mouseEnabled = false;
+ }
+ }
+
+ private function mouseDownHandler(event: MouseEvent): void
+ {
+ textDisplay.setFocus();
}
}
}