XML Feeds

.

[javascript-dev] screentoworld misunderstanding

gusanomaxlist gusanomaxlist at googlemail.com
Wed Nov 7 11:18:16 MST 2007


Hi.
I am trying to write a very basic jsui slider, just by modifying the simpleslider.js from the examples.
Everything went ok until I tried to make the slider horizontal.
It looks like I have a misunderstanding of "sketch.screentoworld".

In vertical mode, I have this working perfectly:
--------------------------------------------
function ondrag(x,y,....)
{
var f,a;
a=sketch.screentoworld(x,y);
f=(a[1]+1)*0.5;
msg_float(f);
}
--------------------------------------------
I thought that replacing a[1] with a[0] would be enough to deal with x coordinates, but for example, if my object is 100x10 pixels, dragging will work horizontally only within 10 pixels around the center (5 left and 5 right) and not on the whole 100...

I had a look at other jsui sliders (matsui,...) but they are way too complicated for me...

Any help is welcome.
Thanx.



More information about the javascript-dev mailing list