Tilemap and "minus" scrollRect?

Is Tilemap supposed to work with scrollRect?
No matter what is scrolled to negative values - parent container or Tilemap itself - rendered tiles are always cropped to “0 and plus” area.

I hope I’m testing it correctly - I can draw using Graphics on negative area, but no Tile can be put there…

Looks like the only way to achieve this is to:

  1. Use scrollRect on parent
  2. Use Matrix on Tilemap with translation (modified tx, ty)

Could you share source for what we should change on BunnyMark to reproduce this?

My goal was to be able to use negative x/y Tile values (or in other words to use 0,0 point that is not in the top-left corner of the Window).

So, in BunnyMark we (luckily) have minX, maxX, minY and maxY variables. Changing them in new() like this:

minX = -100;
maxX = stage.stageWidth - 100;
minY = -100;
maxY = stage.stageHeight - 100;

…and changing Tilemap like this:

tilemap.scrollRect = new openfl.geom.Rectangle(-100, -100, stage.stageWidth, stage.stageHeight);

…doesn’t work as one might expect - Tiles are cropped.

Is this intended for scrollRect to behave like this when used on Tilemap?

Tilemap crops based on the width and height, almost like if the Tilemap was actually an animated bitmap. Perhaps this is what is causing the apparent cropping?

So is it a bug or what? :wink:

No, I think this is the expected behavior :slight_smile:

Tilemap works a bit like Bitmap, you would not expect this to work

bitmapData.setPixel (-100, -100, 0xFF0000);

BitmapData is valid between (0, 0) and (width, height), Tilemap is designed the same way :slight_smile:

Thanks for clarifying @singmajesty!