Range control with floating point values

Write your functional requirement here, be Specific please!

Range control with floating point values

Postby algocrunch » Wed Nov 27, 2013 2:56 am

We have a requirement for the range control to allow floating point values, perhaps this can be a configuration on the Range control?
As a workaround we are able to get the desired functionality by removing Math.floor from Range._ondrag and Range.onDragstop:

Code: Select all
/************ Fix range to allow floating point ********/
xui.UI.Range.$Behaviors.IND2.onDragstop = function (profile, e, src) {
    var p = profile.properties,
                        box = profile.boxing(),
                        rate = profile._rate,
                        d = xui.DragDrop.getProfile(),
                        f,
                        arr = p.$UIvalue.split(':');
    profile._v2 = d.curPos.left;
    arr[1] = (profile._v2) / rate + p.min;
    box.setUIValue(arr.join(':'));
}
xui.UI.Range._ondrag = function (profile, left, src, tag) {
    var p = profile.properties,
                d = xui.DragDrop.getProfile(),
                box = profile.box,
                fun = function (k) { return profile.getSubNode(k) },
                fun2 = function (o, v) { o.get(0).style.width = v + 'px' },
                cap = fun('CAPTION'),
                r1 = fun('RULER1'),
                r3 = fun('RULER3'),
                t, f,
                arr = this._v2a(p.$UIvalue);

    //adjust top
    xui.use(src).get(0).style.top = this._x2y(left) + 'px';

    t = (left) / profile._rate + p.min;

    if (tag) {
        arr[1] = t;
        fun2(r3, left + 8);
    } else {
        arr[0] = t;
        fun2(r1, left + 8);
    }
    cap.html(box._buildTpl(p.singleValue, p.captionTpl, arr, p.unit), false);
}
algocrunch
 
Posts: 40
Joined: Thu Oct 31, 2013 12:50 pm

Re: Range control with floating point values

Postby support » Wed Dec 04, 2013 1:54 pm

That's for old browsers, wen can fix it now.
support
 
Posts: 350
Joined: Sat Apr 27, 2013 9:22 am

Re: Range control with floating point values

Postby algocrunch » Wed Dec 04, 2013 1:57 pm

Great, thank you very much.
algocrunch
 
Posts: 40
Joined: Thu Oct 31, 2013 12:50 pm


Return to Functional Requirement

Who is online

Users browsing this forum: No registered users and 0 guests

cron