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

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



Hi guys,

hmm.. is see. Well, could there maybe at least be the option of making the constrained layer expand 2 px outside the views bounds? I mean is it that weird to want to draw a little bit outside a userview? I can imagine one also wants to be able to put up a shadow or something like that around it?

Using the drawhook is no option here; that would mean every SmoothSlider and RoundButton would need to have an entry in it, which would require a system similar to the OSCresponders and block out any direct use of drawHook. Not desirable.

cheers,
Wouter

Op 19 jun 2009, om 11:23 heeft Scott Wilson het volgende geschreven:

I agree that drawing outside a view's bounds seems really dodgy. The fact that it worked be for is if not a bug, at least is not a feature!

Why don't you use SCWindow:drawHook_ to draw the focus ring?

S.

On 19 Jun 2009, at 10:16, thelych@xxxxxxxxx wrote:

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/


_______________________________________________
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/