Tile - better handling of rotated objects

Here we are tiling rotated rectangles

new Tile(new Rectangle(50,50).rot(45), 5, 5, 0, 0).center().outline();

image

They are being spaced based on the width of the object (which remains the same even if rotated) but it should be based on the width the object's bounds project on the container - so we can use boundsToGlobal() and then pass in the tile as the globalObj parameter - then get the width and height from that.

Okay - that has been patched in ZIM 016. Since we are so close to the release date of ZIM 016 (within a couple weeks) we tend to patch things like this until we announce the release stable.


// needs projected width and height on the tile (that)
var tB = tile.boundsToGlobal(null, null, null, that);
if (!colSize||!zot(width)) w = Math.abs(tB.width);
if (!rowSize||!zot(height)) h = Math.abs(tB.height);

// old
// if (!colSize||!zot(width)) w = Math.abs(tile.width);
// if (!rowSize||!zot(height)) h = Math.abs(tile.height);
1 Like