-
-
Notifications
You must be signed in to change notification settings - Fork 173
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
TypeError: Cannot set properties of undefined (setting '_parentID')
#486
Comments
@jerrygreen pixi-viewport for now works with pixi.js version Just to be sure, look where you are importing the This example of Readme.md works fine to my. import * as PIXI from 'pixi.js'
import { Viewport } from 'pixi-viewport'
const app = new PIXI.Application()
document.body.appendChild(app.view)
// create viewport
const viewport = new Viewport({
screenWidth: window.innerWidth,
screenHeight: window.innerHeight,
worldWidth: 1000,
worldHeight: 1000,
events: app.renderer.events // the interaction module is important for wheel to work properly when renderer.view is placed or scaled
})
// add the viewport to the stage
app.stage.addChild(viewport)
// activate plugins
viewport
.drag()
.pinch()
.wheel()
.decelerate()
// add a red box
const sprite = viewport.addChild(new PIXI.Sprite(PIXI.Texture.WHITE))
sprite.tint = 0xff0000
sprite.width = sprite.height = 100
sprite.position.set(100, 100) |
No, this bug seems to be related to the issue I referenced above, it has nothing to do with 8.0.4 or 8.1.0 I just installed pixi-viewport from GitHub master branch, and it turned out to work just fine. So it’s indeed bug with version on npm. Maybe there are some incompatibilities with 8.1.0, but that’s not one of those. |
yep I think you are right. In my case, I use the latest pixi.js version and downgrade pixi-viewport to v5.0.3 (same to master branch),it works as normal. |
I'm getting this error in runtime when trying to addChild:
Also, typescript complains about type mismatch:
Argument of type 'Sprite' is not assignable to parameter of type 'DisplayObject'
.Versions:
It well might be directly related to this issue:
The text was updated successfully, but these errors were encountered: