flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject svn commit: r1441564 - in /flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls: beads/ beads/controllers/ beads/layouts/ supportClasses/
Date Fri, 01 Feb 2013 18:09:06 GMT
Author: aharui
Date: Fri Feb  1 18:09:06 2013
New Revision: 1441564

URL: http://svn.apache.org/viewvc?rev=1441564&view=rev
Log:
Fix bugs in ScrollBar

Modified:
    flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/ScrollBarBead.as
    flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarThumbBead.as
    flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ScrollBarMouseControllerBase.as
    flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/VScrollBarMouseController.as
    flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/VScrollBarLayout.as
    flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ScrollBar.as

Modified: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/ScrollBarBead.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/ScrollBarBead.as?rev=1441564&r1=1441563&r2=1441564&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/ScrollBarBead.as
(original)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/ScrollBarBead.as
Fri Feb  1 18:09:06 2013
@@ -26,6 +26,7 @@ package org.apache.flex.html.staticContr
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.html.staticControls.Button;
+	import org.apache.flex.html.staticControls.beads.controllers.ButtonAutoRepeatController;
 
 	public class ScrollBarBead implements IBead, IInitSkin, IStrand, IScrollBarBead
 	{
@@ -53,17 +54,19 @@ package org.apache.flex.html.staticContr
 			UIBase(value).addChild(_increment);
 			UIBase(value).addChild(_track);
 			UIBase(value).addChild(_thumb);
-			sbModel = value.getBeadByType(IScrollBarModel) as IScrollBarModel;	
+			sbModel = value.getBeadByType(IScrollBarModel) as IScrollBarModel;
 		}
-			
+		        
 		public function initSkin():void
 		{
 			// TODO: (aharui) put in values impl
 			_increment = new Button();
 			Button(_increment).addBead(new DownArrowButtonBead());
+            Button(_increment).addBead(new ButtonAutoRepeatController());
 			Button(_increment).initSkin();
 			_decrement = new Button();
 			Button(_decrement).addBead(new UpArrowButtonBead());
+            Button(_decrement).addBead(new ButtonAutoRepeatController());
 			Button(_decrement).initSkin();
 			_track = new Button();				
 			Button(_track).addBead(new VScrollBarTrackBead());

Modified: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarThumbBead.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarThumbBead.as?rev=1441564&r1=1441563&r2=1441564&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarThumbBead.as
(original)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarThumbBead.as
Fri Feb  1 18:09:06 2013
@@ -18,9 +18,13 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.staticControls.beads
 {
+    import flash.events.Event;
+    import flash.events.IEventDispatcher;
+    
 	import flash.display.Graphics;
 	import flash.display.Shape;
 	import flash.display.SimpleButton;
+    import flash.display.DisplayObject;
 
 	import org.apache.flex.core.IStrand;
 	
@@ -28,27 +32,23 @@ package org.apache.flex.html.staticContr
 	{
 		public function VScrollBarThumbBead()
 		{
-			upView = new Shape();
-			downView = new Shape();
-			overView = new Shape();
-
-			drawView(upView.graphics, 0xCCCCCC);
-			drawView(downView.graphics, 0x808080);
-			drawView(overView.graphics, 0xEEEEEE);
 		}
 		
 		private function drawView(g:Graphics, bgColor:uint):void
 		{
+            var hh:Number = DisplayObject(_strand).height;
+            g.clear();
 			g.lineStyle(1);
 			g.beginFill(bgColor);
-			g.drawRect(0, 0, 16, 16);
+			g.drawRect(0, 0, 16, hh);
 			g.endFill();
-			g.moveTo(4, 4);
-			g.lineTo(12, 4);
-			g.moveTo(4, 8);
-			g.lineTo(12, 8);
-			g.moveTo(4, 12);
-			g.lineTo(12, 12);
+            hh = Math.round(hh / 2);
+			g.moveTo(4, hh);
+			g.lineTo(12, hh);
+			g.moveTo(4, hh - 4);
+			g.lineTo(12, hh - 4);
+			g.moveTo(4, hh + 4);
+			g.lineTo(12, hh + 4);
 		}
 		
 		private var _strand:IStrand;
@@ -58,7 +58,16 @@ package org.apache.flex.html.staticContr
 		public function set strand(value:IStrand):void
 		{
 			_strand = value;
-			shape = new Shape();
+            
+            upView = new Shape();
+            downView = new Shape();
+            overView = new Shape();
+            
+            drawView(upView.graphics, 0xCCCCCC);
+            drawView(downView.graphics, 0x808080);
+            drawView(overView.graphics, 0xEEEEEE);
+
+            shape = new Shape();
 			shape.graphics.beginFill(0xCCCCCC);
 			shape.graphics.drawRect(0, 0, 16, 16);
 			shape.graphics.endFill();
@@ -66,8 +75,22 @@ package org.apache.flex.html.staticContr
 			SimpleButton(value).downState = downView;
 			SimpleButton(value).overState = overView;
 			SimpleButton(value).hitTestState = shape;
+            IEventDispatcher(_strand).addEventListener("heightChanged", heightChangedHandler);
 		}
 				
+        private function heightChangedHandler(event:Event):void
+        {
+            var hh:Number = DisplayObject(_strand).height;
+            drawView(upView.graphics, 0xCCCCCC);
+            drawView(downView.graphics, 0x808080);
+            drawView(overView.graphics, 0xEEEEEE);
+            
+            shape.graphics.clear();
+            shape.graphics.beginFill(0xCCCCCC);
+            shape.graphics.drawRect(0, 0, 16, hh);
+            shape.graphics.endFill();
+        }
+        
 		private var upView:Shape;
 		private var downView:Shape;
 		private var overView:Shape;

Modified: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ScrollBarMouseControllerBase.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ScrollBarMouseControllerBase.as?rev=1441564&r1=1441563&r2=1441564&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ScrollBarMouseControllerBase.as
(original)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ScrollBarMouseControllerBase.as
Fri Feb  1 18:09:06 2013
@@ -50,6 +50,8 @@ package org.apache.flex.html.staticContr
 			sbView = value.getBeadByType(IScrollBarBead) as IScrollBarBead;
 			sbView.decrement.addEventListener(MouseEvent.CLICK, decrementClickHandler);
 			sbView.increment.addEventListener(MouseEvent.CLICK, incrementClickHandler);
+            sbView.decrement.addEventListener("buttonRepeat", decrementClickHandler);
+            sbView.increment.addEventListener("buttonRepeat", incrementClickHandler);
 			sbView.track.addEventListener(MouseEvent.CLICK, trackClickHandler);
 			sbView.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbMouseDownHandler);
 		}
@@ -71,15 +73,15 @@ package org.apache.flex.html.staticContr
 			return n;
 		}
 		
-		protected function decrementClickHandler(event:MouseEvent):void
+		protected function decrementClickHandler(event:Event):void
 		{
 			sbModel.value = snap(Math.max(sbModel.minimum, sbModel.value - sbModel.stepSize));
 			IEventDispatcher(_strand).dispatchEvent(new Event("scroll"));
 		}
 		
-		protected function incrementClickHandler(event:MouseEvent):void
+		protected function incrementClickHandler(event:Event):void
 		{
-			sbModel.value = snap(Math.min(sbModel.maximum, sbModel.value + sbModel.stepSize));	
+			sbModel.value = snap(Math.min(sbModel.maximum - sbModel.pageSize, sbModel.value + sbModel.stepSize));

 			IEventDispatcher(_strand).dispatchEvent(new Event("scroll"));
 		}
 		

Modified: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/VScrollBarMouseController.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/VScrollBarMouseController.as?rev=1441564&r1=1441563&r2=1441564&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/VScrollBarMouseController.as
(original)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/VScrollBarMouseController.as
Fri Feb  1 18:09:06 2013
@@ -44,7 +44,7 @@ package org.apache.flex.html.staticContr
 				}
 				else
 				{
-					sbModel.value = snap(Math.min(sbModel.maximum, sbModel.value + sbModel.pageStepSize));
+					sbModel.value = snap(Math.min(sbModel.maximum - sbModel.pageSize, sbModel.value + sbModel.pageStepSize));
 					IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
 				}
 			}

Modified: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/VScrollBarLayout.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/VScrollBarLayout.as?rev=1441564&r1=1441563&r2=1441564&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/VScrollBarLayout.as
(original)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/VScrollBarLayout.as
Fri Feb  1 18:09:06 2013
@@ -19,6 +19,7 @@
 package org.apache.flex.html.staticControls.beads.layouts
 {
 	import flash.display.DisplayObject;
+    import flash.events.IEventDispatcher;
 	import flash.events.Event;
 	
 	import org.apache.flex.core.IBead;
@@ -46,8 +47,9 @@ package org.apache.flex.html.staticContr
 			sbModel.addEventListener("minimumChange", changeHandler);
 			sbModel.addEventListener("snapIntervalChange", changeHandler);
 			sbModel.addEventListener("stepSizeChange", changeHandler);
+            sbModel.addEventListener("pageSizeChange", changeHandler);
 			sbModel.addEventListener("valueChange", changeHandler);
-			sbModel.addEventListener("heightChanged", changeHandler);
+			IEventDispatcher(sbView.strand).addEventListener("heightChanged", changeHandler);
 			changeHandler(null);
 		}
 	
@@ -66,10 +68,10 @@ package org.apache.flex.html.staticContr
 			track.x = 0;
 			track.y = decrement.height;
 			track.height = increment.y - decrement.height;
+            thumb.height = sbModel.pageSize / (sbModel.maximum - sbModel.minimum) * track.height;
 			if (track.height > thumb.height)
 			{
 				thumb.visible = true;
-				thumb.height = sbModel.pageSize / (sbModel.maximum - sbModel.minimum) * track.height;
 				thumb.y = (sbModel.value / (sbModel.maximum - sbModel.minimum - sbModel.pageSize) * (track.height
- thumb.height)) + track.y;
 			}
 			else

Modified: flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ScrollBar.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ScrollBar.as?rev=1441564&r1=1441563&r2=1441564&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ScrollBar.as
(original)
+++ flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ScrollBar.as
Fri Feb  1 18:09:06 2013
@@ -26,5 +26,5 @@ package org.apache.flex.html.staticContr
 		{
 			super();
 		}		
-	}
+   	}
 }
\ No newline at end of file



Mime
View raw message