Suggested Improvements Extending Beyond a Quark

Greetings community,

I’ve made a small quark with some methods I think would be worth including in the main branch. I don’t want to assume I know best though and I’m really not sure how I might suggest these changes if they’re useful, so wondering if I can get some input from others about it.

My quark ShapeTools adds some methods for the Rect class such as .radiusV/.radiusH (=) to get or set the vertical or horizontal radius of a Rect so you can resize it from the center or have easy access to its radius.

It also adds .leftCenter, .centerTop, .centerBottom, .rightCenter to get or set each of these points.

I personally find this very helpful for GUI but is this something that would be helpful enough to enough people to be worth adding to the main branch? And if so, how might I request this change be added?

1 Like

Hi! To help you and the community going through this process, I think it would be useful if you could share some of your concrete use cases for this! Thanksss

2 Likes

Good plan, thanks!

Here is an orbit animation in which it’s much easier to call the radius method as opposed to taking the width and height and dividing by 2 every time.

(
w = Window("", Rect(300, 300, 500, 500)).front;
a = 0; //this will be an angle
u = UserView(w, w.view.bounds)
.animate_(true)
.drawFunc_{
	var rect = Rect.aboutPoint(w.view.bounds.center, 50, 50);
	a = a+(2pi/60);
	Pen.strokeOval(rect);
	Pen.color_(Color.red).fillOval(Rect.aboutPoint(( (rect.radiusH*cos(a)) @ (rect.radiusV*sin(a)) ) + w.view.bounds.center, 10, 10))
}
)

Another example using it to set values:

w = Window("", Rect(300, 300, 500, 500)).front; //window
r = Rect.aboutPoint(100@100, 10, 10);  //a rect I want my knob to go in
k = Knob(w, r); //the knob
r = r.radiusH_(30).radiusV_(30); //the knob is centered around where I want it, but it is too small
k = Knob(w, r); //that's better
1 Like