- 編集済み
[runtime-ts] RegionAttachment expectations
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;
I agree. I wonder why that is.
The reference implementation (spine-libgdx) actually sets the .region
field in setRegion
.
spine-runtimes/RegionAttachment.java at master · EsotericSoftware/spine-runtimes · GitHub :: setRegion (L 119-142)
I'm sure @badlogic can elaborate.
It was a lot of code to port, guess I had a brain fart Fixed by having setRegion set the region property.