uxebu/bonsai

Renders wrong after `clone()`, with a `rotation` attr

Opened this issue · 0 comments

The following example should render the same shape in both pieces of code.
Unfortunately the second one screws up the matrix.

var rect = new Rect(100, 100, 100, 100).attr({fillColor: 'red', rotation: 0.78, scaleY: 2});
rect
  .addTo(stage);

// renders different to

var rect = new Rect(100, 100, 100, 100).attr({fillColor: 'red', rotation: 0.78, scaleY: 2});
rect
  .clone({attributes: true})
  .addTo(stage);

A workaround (as long as there is no fix) is to duplicate the matrix too. Like so:

var rect = new Rect(100, 100, 100, 100).attr({fillColor: 'red', rotation: 0.78, scaleY: 2});
rect
  .clone({attributes: true})
  .attr({matrix: rect.attr().matrix}) // this is the workaround, remove it and it renders wrong
  .addTo(stage);