-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[bug] v8 NineSliceSprite doesnt works as mask on Sprite #10442
Comments
Thanks for sharing @Makio64. |
@GoodBoyDigital I didnt try v7 but this might be link with the same bug than here : #10491 if it use renderTexture internally, i will try the same kind of workaround and let you know. |
my current workaround if anyone hit the same problem : import Stage2d from "@/makio/2d/Stage2d";
import { RenderTexture, Sprite } from "pixi.js";
export default class NineSliceMask extends Sprite{
constructor(nineSliceSprite){
let renderTexture = new RenderTexture({
antialias: true,
width: nineSliceSprite.width,
height: nineSliceSprite.height,
})
super(renderTexture)
this.sprite = this.nineSliceSprite = nineSliceSprite
this.renderTexture = renderTexture
// add this one to the main stage to
this.forceRefreshSprite = new Sprite(this.renderTexture)
this.forceRefreshSprite.alpha = 0
this.forceRefreshSprite.visible = false
this.updateTexture()
}
drawMask(){
Stage2d.app.renderer.render({
container: this.nineSliceSprite,
target: this.renderTexture,
clear: true,
})
}
updateTexture(){
if(this.nineSliceSprite.width != this.renderTexture.width || this.nineSliceSprite.height != this.renderTexture.height){
console.log('updatesize', this.nineSliceSprite.width, this.nineSliceSprite.height)
this.renderTexture.resize(this.nineSliceSprite.width, this.nineSliceSprite.height)
}
this.drawMask()
// force refresh on one frame, see bug :
Stage2d.addChild(this.forceRefreshSprite)
setTimeout(()=>{
Stage2d.removeChild(this.forceRefreshSprite)
}, 1)
}
} |
Zyie
added
👍 Not A Bug
Verified issue and is working as intended.
and removed
👍 Not A Bug
Verified issue and is working as intended.
labels
May 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Current Behavior
When a NineSliceSprite is set as a mask of a Sprite , the mask is ignored.
Expected Behavior
When a NineSliceSprite is set as a mask of a Sprite , the mask work.
Steps to Reproduce
Environment
pixi.js
version: 8.1.0Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: