[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] relative coordinates in SCUserView



getting the normalized position is fairly simple. it would like this:

(
var w;
w = SCWindow.new.front;
SCUserView(w, w.view.bounds)
	.mouseMoveAction_{|v, x, y|
"normalized position %".format((v.mousePosition / v.bounds.extent)).postln;
		"relative position %".format(v.mousePosition).postln;
		"absolute position %".format((x@y)).postln;

	}
)

jan


On Dec 11, 2007, at 11:10 AM, thor wrote:


On 10 Dec 2007, at 21:11, Jan Trutzschler wrote:

Here is another option:

you can get the relative mouse position by using the view's method mousePosition, which returns a Point. Should that be a normalized Position between 0 and 1 or just pixels?

That's good way of solving things.

Personally when working with GUIs and drawings I calculate in real pixels
and it would be awkward to map to 0-1 and back into pixels.

Perhaps both?

(that's what I do in my ParaSpace class)

thor

_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel