XML Feeds

.

[javascript-dev] Re: horizontal slider

Emmanuel Jourdan c74-mailinglists at e--j.com
Mon Sep 17 14:21:18 MDT 2007


On 17 sept. 07, at 20:34, Garrett Lynch wrote:

> Hi
>
> thanks for this, definitely seems to work better than mine but the  
> slider itself doesn't seem to follow the cursor pixel for pixel at  
> ether end of the slider - does it need some sort of offset??

Then it's 80 % of the aspect ;-)


function ondrag(x,y,but,cmd,shift,capslock,option,ctrl)
{
	var f,a, height, width, aspect;

	height = box.rect[3] - box.rect[1];
	width = box.rect[2] - box.rect[0];
	aspect = width/height;

	aspect *= 0.8; 	// 80 % of the aspect
	
	a = sketch.screentoworld(x,y);

	//detect horizontal movement
	f = (a[0] + aspect) / (2*aspect);

	msg_float(f); //set new value with clipping + refresh
}

Cheers,
ej




More information about the javascript-dev mailing list