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

Re: [sc-users] drawing outside a UserView broken?



hi wouter,

with relativeOrigin = true the UserView draws in a separate, and constrained layer whose bounds are equal to the view bounds.
you cannot draw outside of it. It's like it clips the region.

there is no workaround.

I do not consider it as a bug. Actually i think drawing inside a view should be constrained to its bounds.

since relativeOrigin will be / is deprecated, a *possible workaround* would be to add a flag to disable this layer and allow to draw outside of the view but this possibility will be a kind of *hack* : meaning there is few cases where those extended drawings won't be refreshed correctly, probably leaving the window with dirty drawings inside.

that should be probably discussed in the dev-list before.

until then you have to use relativeOrigin = false to draw your custom focus ring... wich i know may not stand in future releases.

best,
charles

Le 19 juin 09 à 10:40, Wouter Snoei a écrit :

Hi,

I'm trying to update my lib to reflect the deprication of relativeOrigin, but stumbled across a problem: as soon as I set relativeOrigin to false on a UserView, it doesn't draw outside its borders anymore. This is problematic since I draw my own focus rings around all my gui widgets. Even when I do a refreshInRect with the correct bounds it still doesn't draw. Is this a bug or a feature? And in any case; how to work around it?

(
w = Window().front;
w.addFlowLayout;

a = UserView( w, 100@100 ).relativeOrigin_(false)
	.focusColor_( Color.clear )
	.drawFunc_({ |vw|
		var bounds = vw.bounds;
		Pen.addRect( bounds.insetBy(-1,-1) );
		Pen.line( bounds.leftTop, bounds.rightBottom );
		Pen.line( bounds.rightTop, bounds.leftBottom );
		Pen.stroke
		});
	
b = UserView( w, 100@100 ).relativeOrigin_(true)
	.focusColor_( Color.clear )
	.drawFunc_({ |vw|
		var bounds = vw.bounds.moveTo(0,0);
		Pen.addRect( bounds.insetBy(-1,-1) ); // doesn't show!!
		Pen.line( bounds.leftTop, bounds.rightBottom );
		Pen.line( bounds.rightTop, bounds.leftBottom );
		Pen.stroke
		});
)

cheers,
Wouter

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/