• Runtimes
  • [runtime-ts] RegionAttachment expectations

  • 編集済み
Related Discussions
...

When loading region attachments with an alternate attachment loader, the api expects that the loader also sets the property region to the region object after it is set with setRegion. this does not make sence.

core/src/TextureAtlasAttachmentLoader.ts:45
let attachment = new RegionAttachment(name);
attachment.setRegion(region);
attachment.region = region;

/Moberg


The only place the region property is used is here:

core/src/attachments/RegionAttachment.ts:119
let regionScaleX = this.width / this.region.originalWidth * this.scaleX;
let regionScaleY = this.height / this.region.originalHeight * this.scaleY;

It was a lot of code to port, guess I had a brain fart 🙂 Fixed by having setRegion set the region property.