Skip to content
This repository has been archived by the owner on Oct 14, 2019. It is now read-only.

Commit

Permalink
Improved slider value calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Oct 15, 2013
1 parent e6978af commit 0d079ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
Binary file modified docs/demo/haxeuitoolkit.swf
Binary file not shown.
8 changes: 4 additions & 4 deletions docs/haxe-ui-toolkit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20595,15 +20595,15 @@
</class>
<class path="haxe.ui.toolkit.controls._Progress.HProgressLayout" params="" file="src/haxe/ui/toolkit/controls/Progress.hx" private="1" module="haxe.ui.toolkit.controls.Progress">
<extends path="haxe.ui.toolkit.layout.DefaultLayout"/>
<repositionChildren public="1" set="method" line="193" override="1"><f a=""><x path="Void"/></f></repositionChildren>
<repositionChildren public="1" set="method" line="197" override="1"><f a=""><x path="Void"/></f></repositionChildren>
<resizeChildren public="1" set="method" line="156" override="1"><f a=""><x path="Void"/></f></resizeChildren>
<new public="1" set="method" line="152"><f a=""><x path="Void"/></f></new>
</class>
<class path="haxe.ui.toolkit.controls._Progress.VProgressLayout" params="" file="src/haxe/ui/toolkit/controls/Progress.hx" private="1" module="haxe.ui.toolkit.controls.Progress">
<extends path="haxe.ui.toolkit.layout.DefaultLayout"/>
<repositionChildren public="1" set="method" line="263" override="1"><f a=""><x path="Void"/></f></repositionChildren>
<resizeChildren public="1" set="method" line="227" override="1"><f a=""><x path="Void"/></f></resizeChildren>
<new public="1" set="method" line="223"><f a=""><x path="Void"/></f></new>
<repositionChildren public="1" set="method" line="264" override="1"><f a=""><x path="Void"/></f></repositionChildren>
<resizeChildren public="1" set="method" line="224" override="1"><f a=""><x path="Void"/></f></resizeChildren>
<new public="1" set="method" line="220"><f a=""><x path="Void"/></f></new>
</class>
<class path="haxe.ui.toolkit.controls.Spacer" params="" file="src/haxe/ui/toolkit/controls/Spacer.hx">
<extends path="haxe.ui.toolkit.core.Component"/>
Expand Down
28 changes: 10 additions & 18 deletions src/haxe/ui/toolkit/controls/Progress.hx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ private class HProgressLayout extends DefaultLayout {
} else if (cx > ucx) {
cx = ucx;
}

if (thumb != null) {
cx += thumb.width / 2;
}

if (cx == 0) {
value.visible = false;
Expand All @@ -202,17 +206,10 @@ private class HProgressLayout extends DefaultLayout {

var scroll:IScrollable = cast(container, IScrollable);
if (value != null) {
//value.y = (container.height / 2) - (value.height / 2);

var thumb:IDisplayObject = container.findChild("thumb");
if (thumb != null) {
var xpos:Float = value.x;
if (scroll.pos != scroll.min) {
xpos += value.width;
if (scroll.pos != scroll.max) { // bit of a hack
xpos--;
}
}
var xpos:Float = value.x + value.width - (thumb.width / 2);
thumb.x = Std.int(xpos);
}
}
Expand Down Expand Up @@ -251,6 +248,10 @@ private class VProgressLayout extends DefaultLayout {
cy = ucy;
}

if (thumb != null) {
cy += thumb.height / 2;
}

if (cy == 0) {
value.visible = false;
} else {
Expand All @@ -273,20 +274,11 @@ private class VProgressLayout extends DefaultLayout {
var scroll:IScrollable = cast(container, IScrollable);
if (value != null) {
var ucy:Float = usableHeight;
//value.x = (container.width / 2) - (value.width / 2);
value.y = ucy - value.height - background.layout.padding.bottom;

var thumb:IDisplayObject = container.findChild("thumb");
if (thumb != null) {
var ypos:Float = value.y;
if (scroll.pos != scroll.min) {
ypos -= thumb.height;
if (scroll.pos != scroll.max) { // bit of a hack
ypos++;
}
} else {
ypos = innerHeight - thumb.height;
}
var ypos:Float = value.y - (thumb.height / 2);
thumb.y = Std.int(ypos);
}
}
Expand Down

0 comments on commit 0d079ff

Please sign in to comment.