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 2015/08/12 20:47:08 UTC

[02/15] git commit: [flex-asjs] [refs/heads/develop] - promote scrollposition so we don't need to reference model

promote scrollposition so we don't need to reference model


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

Branch: refs/heads/develop
Commit: 29d459472b8564308d725c5e5e8be76049db296f
Parents: a968950
Author: Alex Harui <ah...@apache.org>
Authored: Fri Aug 7 17:26:58 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Aug 7 17:26:58 2015 -0700

----------------------------------------------------------------------
 .../src/productsView/ProductCatalogPanel.mxml   |  8 +++----
 .../html/supportClasses/ScrollingViewport.as    | 18 ++++++++++++++++
 .../html/supportClasses/ScrollingViewport.js    | 22 ++++++++++++++++++++
 3 files changed, 44 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/29d45947/examples/FlexJSStore/src/productsView/ProductCatalogPanel.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSStore/src/productsView/ProductCatalogPanel.mxml b/examples/FlexJSStore/src/productsView/ProductCatalogPanel.mxml
index 324ff97..a3ee845 100755
--- a/examples/FlexJSStore/src/productsView/ProductCatalogPanel.mxml
+++ b/examples/FlexJSStore/src/productsView/ProductCatalogPanel.mxml
@@ -298,7 +298,7 @@ limitations under the License.
 			else
 			{
 			    //since movement is happening get the scrollbar back to the top
-				scv.model.verticalScrollPosition = 0;
+				scv.verticalScrollPosition = 0;
                 // Fade in newly selected thumbnails after the last
 				// visible thumbnail has moved to its new position.
                 move.addEventListener(Effect.EFFECT_END,
@@ -399,16 +399,16 @@ limitations under the License.
                 move.addEventListener(Effect.EFFECT_END,
 					function(e:org.apache.flex.events.Event):void
 					{
-					    var curpos:int = scv.model.verticalScrollPosition;
+					    var curpos:int = scv.verticalScrollPosition;
 					    if (selectedThumb.y < curpos)
 					    {
-					        scv.model.verticalScrollPosition = y;
+					        scv.verticalScrollPosition = y;
 					    }
 					    else if (selectedThumb.y + ProductCatalogThumbnail.COL_HEIGHT_4 > curpos + thumbContentGroup.height)
 					    {
 					        //this logic doesn't seem to be perfect but it will do
 					        var diff:int = selectedThumb.y - (curpos + thumbContentGroup.height)
-					        scv.model.verticalScrollPosition += diff + ProductCatalogThumbnail.COL_HEIGHT_4 + ProductCatalogThumbnail.VERTICAL_GAP;
+					        scv.verticalScrollPosition += diff + ProductCatalogThumbnail.COL_HEIGHT_4 + ProductCatalogThumbnail.VERTICAL_GAP;
 					    }
 					});
             }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/29d45947/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/ScrollingViewport.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/ScrollingViewport.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/ScrollingViewport.as
index a2f220b..3c128af 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/ScrollingViewport.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/ScrollingViewport.as
@@ -59,6 +59,24 @@ package org.apache.flex.html.supportClasses
 		{
 			return _horizontalScroller;
 		}
+        
+        public function get verticalScrollPosition():Number
+        {
+            return _model.verticalScrollPosition;
+        }
+        public function set verticalScrollPosition(value:Number):void
+        {
+            _model.verticalScrollPosition = value;
+        }
+        
+        public function get horizontalScrollPosition():Number
+        {
+            return _model.horizontalScrollPosition;
+        }
+        public function set horizontalScrollPosition(value:Number):void
+        {
+            _model.horizontalScrollPosition = value;
+        }
 		
 		/**
 		 * Invoke this function to reshape and set the contentArea being managed by

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/29d45947/frameworks/projects/HTML/js/src/org/apache/flex/html/supportClasses/ScrollingViewport.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/supportClasses/ScrollingViewport.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/supportClasses/ScrollingViewport.js
index f7ac3e0..4b1a1d9 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/supportClasses/ScrollingViewport.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/supportClasses/ScrollingViewport.js
@@ -71,6 +71,28 @@ Object.defineProperties(org.apache.flex.html.supportClasses.ScrollingViewport.pr
         }
     },
     /** @export */
+    verticalScrollPosition: {
+        /** @this {org.apache.flex.html.supportClasses.ScrollingViewport} */
+        get: function() {
+            return this.strand.positioner.scrollTop;
+        },
+        /** @this {org.apache.flex.html.supportClasses.ScrollingViewport} */
+        set: function(value) {
+             this.strand.positioner.scrollTop = value;
+        }
+    },
+    /** @export */
+    horizontalScrollPosition: {
+        /** @this {org.apache.flex.html.supportClasses.ScrollingViewport} */
+        get: function() {
+            return this.strand.positioner.scrollLeft;
+        },
+        /** @this {org.apache.flex.html.supportClasses.ScrollingViewport} */
+        set: function(value) {
+             this.strand.positioner.scrollLeft = value;
+        }
+    },
+    /** @export */
     strand: {
         /** @this {org.apache.flex.html.supportClasses.ScrollingViewport} */
         get: function() {