You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ca...@apache.org on 2016/11/06 12:17:57 UTC

[31/40] git commit: [flex-asjs] [refs/heads/feature/mdl] - MDL Slider fixes

MDL Slider fixes


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

Branch: refs/heads/feature/mdl
Commit: a1ed36c76fe113c11b22e8d6f12a16ee6562f6eb
Parents: 9ac5f7a
Author: Carlos Rovira <ca...@apache.org>
Authored: Thu Nov 3 11:00:15 2016 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Sun Nov 6 13:15:38 2016 +0100

----------------------------------------------------------------------
 .../flexjs/MDLExample/src/main/flex/App.mxml    |  4 ++-
 .../src/main/flex/org/apache/flex/mdl/Slider.as | 37 +++++++++++---------
 2 files changed, 24 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a1ed36c7/examples/flexjs/MDLExample/src/main/flex/App.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/App.mxml b/examples/flexjs/MDLExample/src/main/flex/App.mxml
index dca2da1..8487f5b 100644
--- a/examples/flexjs/MDLExample/src/main/flex/App.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/App.mxml
@@ -102,7 +102,9 @@ limitations under the License.
                 </mdl:RadioButton>
                 <mdl:RadioButton groupName="g1" text="Red"/>
 
-                <mdl:Slider minimum="0" maximum="100" value="0"/>
+                <mdl:Slider/>
+
+                <mdl:Slider minimum="0" maximum="10" value="2" stepSize="2" width="200"/>
 
             </js:Form>
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a1ed36c7/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Slider.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Slider.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Slider.as
index 2587227..31267ad 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Slider.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Slider.as
@@ -87,7 +87,7 @@ package org.apache.flex.mdl
 
 			COMPILE::JS
 			{
-				(element as HTMLInputElement).value = "" + value;
+				(element as HTMLInputElement).value = IRangeModel(model).value.toString();
 			}
 		}
 		
@@ -109,7 +109,7 @@ package org.apache.flex.mdl
 
 			COMPILE::JS
 			{
-				(element as HTMLInputElement).min = "" + value;
+				(element as HTMLInputElement).min = IRangeModel(model).minimum.toString();
 			}
 		}
 		
@@ -131,7 +131,7 @@ package org.apache.flex.mdl
 
 			COMPILE::JS
 			{
-				(element as HTMLInputElement).max = "" + value;
+				(element as HTMLInputElement).max = IRangeModel(model).maximum.toString();
 			}
 			
 		}
@@ -170,6 +170,11 @@ package org.apache.flex.mdl
         public function set stepSize(value:Number):void
         {
             IRangeModel(model).stepSize = value;
+
+			COMPILE::JS
+			{
+				(element as HTMLInputElement).step = IRangeModel(model).stepSize.toString();
+			}
         }
 
         COMPILE::JS
@@ -191,33 +196,33 @@ package org.apache.flex.mdl
         COMPILE::JS
         override protected function createElement():WrappedHTMLElement
         {
-            input = document.createElement('input') as HTMLInputElement;
-			input.type = "range";
-			//input.min = "0";
-			//input.max = "100";
-			//input.value = "0";
+			var p:HTMLElement = document.createElement('p') as HTMLElement;
+            p.style.width = '300px';
 
+			input = document.createElement('input') as HTMLInputElement;
+			input.type = "range";
+			input.value = IRangeModel(model).value.toString();
+			input.min = IRangeModel(model).minimum.toString();
+			input.max = IRangeModel(model).maximum.toString();
+			input.step = IRangeModel(model).stepSize.toString();
+			input.className = 'mdl-slider mdl-js-slider';
 
-            //input.style.width = '200px';
-            //input.style.height = '30px';
+			p.appendChild(input);
 
 			element = input as WrappedHTMLElement;
             
             //track = new SliderTrackView();
-            //addBead(track);
-            
+            //addBead(track);            
             //thumb = new SliderThumbView();
             //addBead(thumb);
-            
             //controller = new SliderMouseController();
             //addBead(controller);
             
-            positioner = element;
+            positioner = p as WrappedHTMLElement;
             positioner.style.position = 'relative';
+			(input as WrappedHTMLElement).flexjs_wrapper = this;
             element.flexjs_wrapper = this;
             
-            className = typeNames = 'mdl-slider mdl-js-slider';
-            
             return element;
         }