While testing Joan's use of stretch block, I believe I found a bug. It seems that height of a costume can only be stretched up to 250% and then something strange happens, it moves the sprite to the right and deforms its width - watch video below.
Hi @jens!
I see where is the problem.
As you are changing Morphic, I don't submit a PR, but I document it here and explain what I would do...
Costume.prototype.stretched creates a new Costume and then, this runs shrinkToFit(this.maxExtent()). So, new stretched costumes can not bigger than Stage dimensions.
And, in addition to this limitation, the problem is that Costume center is calculated with the unlimited dimensions.
My fastest (and I think fine) solution would be adding a parameter noFit to Costume function. This ensures that it does not damage any other code. In fact, only two lines at objects.js. @jens if you agree this, I'll submit a PR... But maybe you are changing something related...
The idea...
function Costume(canvas, name, rotationCenter, noFit ) {
...
if (!noFit) {this.shrinkToFit(this.maxExtent()); }
and then
Costume.prototype.stretched = function (w, h) {
...
stretched = new Costume(
canvas,
this.name,
center,
true
);
Hi @jguille2, this is another brilliant analysis and a fabulous suggestion how to address this issue, thank you so much! I would welcome your pull-request, as I love your solution. This is not affected by the new Morphic architecture, so your fix would be perfect.