Skip to content

Conversation

@JustKira
Copy link

@JustKira JustKira commented Jan 2, 2026

Summary

Adds per-region tiling support for 9-slice sprites via a new tileMode option in the slice9 config.

New Options

  • 'none' - stretch all regions (default, existing behavior)
  • 'edges' - tile edge regions, stretch center
  • 'center' - tile center region, stretch edges
  • 'all' - tile both edges and center

Corners never tile.

Usage

loadSprite('panel', '/sprites/panel.png', {
    slice9: {
        left: 32, right: 32, top: 32, bottom: 32,
        tileMode: 'edges',
    },
});

Changes

  • Extended NineSlice type with tileMode property
  • Modified 9-slice rendering to apply tiling per-region
  • Added warning when deprecated tiled option is used with slice9
  • Added example slice9Tiled.js with test sprites

Example

Screen.Recording.2026-01-02.at.6.38.22.AM.mov
  • Changeloged

Add per-region tiling support for 9-slice sprites with a new tileMode option:
- 'none': stretch all regions (default, existing behavior)
- 'edges': tile edge regions, stretch center
- 'center': tile center region, stretch edges
- 'all': tile both edges and center

Corners never tile.

Also adds warning when 'tiled' option is used with slice9 sprites,
directing users to use tileMode instead.
@JustKira
Copy link
Author

JustKira commented Jan 2, 2026

Small Note i dont understand why some code changed even i Ran the format but it seems format changed? not sure. but changes are like 10lines or less other are noise not sure if its from my Editor or not.

@mflerackers
Copy link
Member

Did you run npm run fmt?

@JustKira
Copy link
Author

JustKira commented Jan 2, 2026

Did you run npm run fmt?

Yes i did

JustKira and others added 2 commits January 2, 2026 19:22
Co-authored-by: dragoncoder047 <101021094+dragoncoder047@users.noreply.github.com>
@lajbel
Copy link
Member

lajbel commented Jan 4, 2026

LGTM, very high-quality PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants