Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaling a tilemap breaks clipping. #2699

Closed
thefakeplace opened this issue Jul 17, 2023 · 2 comments · Fixed by #2700
Closed

Scaling a tilemap breaks clipping. #2699

thefakeplace opened this issue Jul 17, 2023 · 2 comments · Fixed by #2700
Labels
bug This issue describes undesirable, incorrect, or unexpected behavior

Comments

@thefakeplace
Copy link

thefakeplace commented Jul 17, 2023

Steps to Reproduce

Create a tilemap and apply scaling to it.

const createTilemap = () => {
  const tilemap = new TileMap({
    rows: 16,
    columns: 16,
    tileWidth: SHEET_TILE_WIDTH,
    tileHeight: SHEET_TILE_HEIGHT,
  });

  for (const cell of tilemap.tiles) {
    const sprite = spriteSheet.getSprite(0
    cell.addGraphic(sprite);
  }

  tilemap.scale = vec(
    WORLD_TILE_WIDTH / SHEET_TILE_WIDTH,
    WORLD_TILE_HEIGHT / SHEET_TILE_HEIGHT,
  );
  return tilemap;
};

Expected Result

Clipping works.

Actual Result

Tiles are incorrectly clipped when they leave the camera view.

Screen.Recording.2023-07-16.at.10.48.07.PM.mov
@eonarheim eonarheim added the bug This issue describes undesirable, incorrect, or unexpected behavior label Jul 17, 2023
@eonarheim
Copy link
Member

@thefakeplace Thanks for the issue! Definitely a bug!

I'll take a look at this soon 👍

As a possible work around you could look at zooming the camera Camera.zoom to get the scaling you are looking to see.

@thefakeplace
Copy link
Author

Thanks! That works for me

eonarheim added a commit that referenced this issue Jul 18, 2023
Closes #2699 

## Changes:

- Update the offscreen logic to respect scaling
- Fix scale issues in tile by point
- Fix bounds recalculation when parts of the transform change (pos/scale)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes undesirable, incorrect, or unexpected behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants