diff --git a/packages/assetpack/src/texture-packer/packer/createTextureData.ts b/packages/assetpack/src/texture-packer/packer/createTextureData.ts index 832c2859..3397b6be 100644 --- a/packages/assetpack/src/texture-packer/packer/createTextureData.ts +++ b/packages/assetpack/src/texture-packer/packer/createTextureData.ts @@ -15,7 +15,7 @@ export async function createTextureData(options: Required) const packer = new MaxRectsPacker(options.width, options.height, options.padding, { smart: true, pot: options.powerOfTwo, - border: options.padding, + border: options.border, allowRotation: options.allowRotation, }); diff --git a/packages/assetpack/src/texture-packer/packer/fitTextureToPacker.ts b/packages/assetpack/src/texture-packer/packer/fitTextureToPacker.ts index 00a602da..2f313126 100644 --- a/packages/assetpack/src/texture-packer/packer/fitTextureToPacker.ts +++ b/packages/assetpack/src/texture-packer/packer/fitTextureToPacker.ts @@ -2,7 +2,7 @@ import type { PackTexturesOptions, PixiPacker } from './packTextures.js'; export function fitTextureToPacker( bin: PixiPacker, - { width, height, fixedSize, padding, powerOfTwo }: PackTexturesOptions, + { width, height, fixedSize, border, powerOfTwo }: PackTexturesOptions, ) { if (!fixedSize) { width = 0; @@ -20,8 +20,8 @@ export function fitTextureToPacker( } } - height += padding ?? 0; - width += padding ?? 0; + height += border ?? 0; + width += border ?? 0; if (powerOfTwo) { height = nearestPowerOf2(height); diff --git a/packages/assetpack/src/texture-packer/packer/packTextures.ts b/packages/assetpack/src/texture-packer/packer/packTextures.ts index ba7c7691..540449fb 100644 --- a/packages/assetpack/src/texture-packer/packer/packTextures.ts +++ b/packages/assetpack/src/texture-packer/packer/packTextures.ts @@ -31,6 +31,7 @@ export interface PackTexturesOptions { texturesToPack: { path: string; contents: Buffer }[]; textureName: string; padding?: number; + border?: number; fixedSize?: boolean; powerOfTwo?: boolean; width?: number; @@ -57,6 +58,7 @@ export async function packTextures(_options: PackTexturesOptions): PromiseDefaults to `png`. | | texturePacker.padding | `number` | The padding between sprites in the texture atlas.
Defaults to `2`. | +| texturePacker.border | `number` | The padding around the edge of the packed texture atlas.
Defaults to `2`. | | texturePacker.fixedSize | `boolean` | Whether the texture atlas should be a fixed size.
Defaults to `false`. | | texturePacker.powerOfTwo | `boolean` | Whether the texture atlas should be a power of two.
Defaults to `false`. | | texturePacker.width | `number` | The width of the texture atlas.
Defaults to `1024`. |