Closed jialongsu closed 1 year ago
Not sure what that means. maybe provide a video?
import * as PIXI from 'pixi.js' import { Viewport } from 'pixi-viewport'
// or with require // const PIXI = require('pixi.js') // const Viewport = require('pixi-viewport').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,
interaction: app.renderer.plugins.interaction // 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)
There's probably a bug in InputManager.ts. My guess is that the count() function is not properly decremented when multiple touch points are released in a pointerup event (although, I'm not sure how that works). It would have to be debugged. I'd add a console.log(event) on line 171 of InputManager.ts to see how many pointerup events are called and what they look like.
Finding the same issue as this issue and using the same resolution method can resolve the problem. https://github.com/davidfig/pixi-viewport/issues/364
fix code:
viewport.on('drag-end', () => { app.renderer.plugins.interaction.interactionDataPool = []; });
"pixi-viewport": "^4.35.1", "pixi.js": "^6.5.4",
100% repetition