This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new a4a1c7f BrowserOrientation educe events to just one
a4a1c7f is described below
commit a4a1c7fec1bf722585b04ff841646445b846395c
Author: Carlos Rovira <[email protected]>
AuthorDate: Sun Feb 17 20:23:59 2019 +0100
BrowserOrientation educe events to just one
---
.../TourDeJewel/src/main/royale/MainContent.mxml | 21 ++++++++-------------
.../org/apache/royale/core/BrowserOrientation.as | 6 ++----
2 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/examples/royale/TourDeJewel/src/main/royale/MainContent.mxml
b/examples/royale/TourDeJewel/src/main/royale/MainContent.mxml
index dbb982f..4041389 100644
--- a/examples/royale/TourDeJewel/src/main/royale/MainContent.mxml
+++ b/examples/royale/TourDeJewel/src/main/royale/MainContent.mxml
@@ -68,22 +68,17 @@ limitations under the License.
_listenToOrientation = listen;
if(_listenToOrientation)
{
- addEventListener('orientationPortrait',
notifyOrientation);
- addEventListener('orientationLandscape',
notifyOrientation);
+ addEventListener("orientationChanged",
notifyOrientation);
} else {
- removeEventListener('orientationPortrait',
notifyOrientation);
- removeEventListener('orientationLandscape',
notifyOrientation);
+ removeEventListener("orientationChanged",
notifyOrientation);
}
}
- public function notifyOrientation(event:Event):void
+ public function notifyOrientation(event:Event =
null):void
{
- if(event.type == 'orientationPortrait')
- {
- orientation = "Portrait";
- }
- if(event.type == 'orientationLandscape')
- {
- orientation = "Landscape";
+ if(bo.orientation ==
BrowserOrientation.PORTRAIT) {
+ orientation =
BrowserOrientation.PORTRAIT;
+ } else if(bo.orientation == BrowserOrientation.LANDSCAPE) {
+ orientation =
BrowserOrientation.LANDSCAPE;
}
}
@@ -98,7 +93,7 @@ limitations under the License.
<j:beads>
<js:ContainerDataBinding/>
- <js:BrowserOrientation/>
+ <js:BrowserOrientation localId="bo"/>
</j:beads>
<j:Drawer localId="drawer">
diff --git
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as
index 713fe4b..ad09c5a 100644
---
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as
+++
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as
@@ -99,7 +99,7 @@ COMPILE::JS
public function set orientation(value:String):void
{
_orientation = value;
- host.dispatchEvent(new Event('orientation'+_orientation));
+ host.dispatchEvent(new Event("orientationChanged"));
}
/**
@@ -125,14 +125,12 @@ COMPILE::JS
}
} else if(OSUtils.getOS() == OSUtils.ANDROID_OS)
{
- if(orientation != PORTRAIT &&
screen.orientation.type.indexOf("portrait") != -1 )
- {
+ if(orientation != PORTRAIT &&
screen.orientation.type.indexOf("portrait") != -1 ) {
orientation = PORTRAIT;
} else if (orientation != LANDSCAPE &&
screen.orientation.type.indexOf("landscape") != -1) {
orientation = LANDSCAPE;
}
}
-
}
}
}