Partial solution to the NumericStepper issue.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/8dc27279 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/8dc27279 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/8dc27279 Branch: refs/heads/tlf Commit: 8dc27279a01e37674bd39b606aae4d63dd5f6477 Parents: 04a63b6 Author: Peter Ent <p...@apache.org> Authored: Wed Jun 7 17:17:25 2017 -0400 Committer: Peter Ent <p...@apache.org> Committed: Wed Jun 7 17:17:25 2017 -0400 ---------------------------------------------------------------------- .../flex/html/beads/NumericStepperView.as | 34 ++++++++++++++++---- .../org/apache/flex/html/beads/SpinnerView.as | 17 ++++++++++ .../Basic/src/main/resources/defaults.css | 4 ++- 3 files changed, 48 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8dc27279/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as index 807eef0..4c7e6ba 100644 --- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as @@ -82,6 +82,8 @@ package org.apache.flex.html.beads input = new TextInput(); input.className = "NumericStepperInput"; input.typeNames = "NumericStepperInput"; + input.width = 100; + input.height = 22; IParent(value).addElement(input); COMPILE::JS { @@ -93,6 +95,7 @@ package org.apache.flex.html.beads spinner.addBead( UIBase(value).model as IBead ); IParent(value).addElement(spinner); spinner.height = input.height; + spinner.width = input.height/2; COMPILE::JS { spinner.positioner.style.display = 'inline-block'; @@ -120,10 +123,22 @@ package org.apache.flex.html.beads input.text = String(spinner.value); - var host:ILayoutChild = ILayoutChild(value); - if ((!host.isWidthSizedToContent() && !isNaN(host.explicitWidth)) || - (!host.isHeightSizedToContent() && !isNaN(host.explicitHeight))) - sizeChangeHandler(null); + COMPILE::SWF + { + var host:ILayoutChild = ILayoutChild(value); + + // Complete the setup if the height is sized to content or has been explicitly set + // and the width is sized to content or has been explicitly set + if ((host.isHeightSizedToContent() || !isNaN(host.explicitHeight)) && + (host.isWidthSizedToContent() || !isNaN(host.explicitWidth))) + sizeChangeHandler(null); + } + COMPILE::JS + { + // always run size change since there are no size change events + sizeChangeHandler(null); + } + } /** @@ -131,13 +146,20 @@ package org.apache.flex.html.beads */ private function sizeChangeHandler(event:Event) : void { + COMPILE::JS + { + spinner.height = input.height; + spinner.width = input.height/2; + } + input.x = 0; input.y = 0; input.width = UIBase(_strand).width-spinner.width-2; + COMPILE::SWF { - spinner.x = input.width; - spinner.y = 0; + spinner.x = input.width; + spinner.y = 0; } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8dc27279/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as index 4023036..47f270f 100644 --- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as @@ -27,6 +27,7 @@ COMPILE::SWF { import org.apache.flex.core.IBeadView; import org.apache.flex.core.IRangeModel; import org.apache.flex.core.IStrand; + import org.apache.flex.core.ILayoutChild; import org.apache.flex.core.UIBase; import org.apache.flex.events.Event; import org.apache.flex.events.IEventDispatcher; @@ -122,6 +123,22 @@ COMPILE::JS { controller = new SpinnerMouseController(); host.addBead(controller); } + + COMPILE::SWF + { + var host:ILayoutChild = ILayoutChild(value); + + // Complete the setup if the height is sized to content or has been explicitly set + // and the width is sized to content or has been explicitly set + if ((host.isHeightSizedToContent() || !isNaN(host.explicitHeight)) && + (host.isWidthSizedToContent() || !isNaN(host.explicitWidth))) + sizeChangeHandler(null); + } + COMPILE::JS + { + // always run size change since there are no size change events + sizeChangeHandler(null); + } } /** http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8dc27279/frameworks/projects/Basic/src/main/resources/defaults.css ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/resources/defaults.css b/frameworks/projects/Basic/src/main/resources/defaults.css index c3425b0..026c933 100644 --- a/frameworks/projects/Basic/src/main/resources/defaults.css +++ b/frameworks/projects/Basic/src/main/resources/defaults.css @@ -473,11 +473,13 @@ Spinner IBeadModel: ClassReference("org.apache.flex.html.beads.models.RangeModel"); IBeadView: ClassReference("org.apache.flex.html.beads.SpinnerView"); width: 16px; + height: 32px; } .SpinnerButton { - padding: 1px; + padding: 0; + margin: 0; font-size: 6px; }