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/244ea0fa Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/244ea0fa Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/244ea0fa Branch: refs/heads/feature/mdl Commit: 244ea0fa56ba51421e6866f9293defa21a03e477 Parents: 6cbde66 Author: Carlos Rovira <carlosrov...@apache.org> Authored: Thu Nov 3 11:00:15 2016 +0100 Committer: Carlos Rovira <carlosrov...@apache.org> Committed: Sun Nov 6 02:28:52 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/244ea0fa/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/244ea0fa/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; }