XDracam / unity-corelibrary

Collection of classes and extension methods that make life with Unity3D more comfortable
MIT License
16 stars 3 forks source link

Swizzeling, .With & other Misc Extensions for Rects #50

Open Eregerog opened 5 years ago

Eregerog commented 5 years ago

While I'm not so sure about swizzeling, being able to easily modfiy&copy a rect is something that could help a lot.

Here are a few examples: var indentedRect = rect.WithX(x => x - 15).WithWidth(w => w - 15); The above example would be easier with a method that "splits / indents" a rect: var indentedRect = rect.IndentRight(15); // This code would behave the same as the one from above Swizzeling could work like this, but it doesn't seem so useful: var transposedRect = rect.yxhw; //Switches x and y and width and height