pixi-viewport icon indicating copy to clipboard operation
pixi-viewport copied to clipboard

Cant use decelerate, drag or anything.

Open ziarmandhost opened this issue 4 years ago • 6 comments

Also i cant use speed in follow script. I cant understand why. I use pixi-culling with pixi-viewport, maybe there are issues connected with that? @davidfig please, help

ziarmandhost avatar Jun 18 '21 18:06 ziarmandhost

Can you provide a simple code example of this issue?

mhazy avatar Jul 13 '21 18:07 mhazy

Can you provide a simple code example of this issue?

Call: Core.Graphics.viewport.follow(Core.Graphics.camera, {speed: 0.25});

Core.Graphics (where i create camera): `Graphics.app = new PIXI.Application({ width: window.innerWidth, height: window.innerHeight, resizeTo: window, autoresize: true, transparent: true }); document.body.appendChild(Graphics.app.view);

    Graphics.viewport = new Viewport({
        screenWidth: window.innerWidth,
        screenHeight: window.innerHeight,

        stopPropagation: true,
        disableOnContextMenu: true,

        interaction: Graphics.app.renderer.plugins.interaction
    });
    Graphics.app.stage.addChild(Graphics.viewport);

    this.setupCulling();

    Graphics.configure();

    Graphics.camera = new PIXI.DisplayObject();`

Configure: `static configure() { Graphics.app.stage.interactive = true;

    Graphics.viewport
        .drag()
        .pinch()
        .wheel()
        .decelerate()

    Graphics.viewport.position.x = window.innerWidth / 2;
    Graphics.viewport.position.y = window.innerHeight / 2;
    Graphics.viewport.scale.x = Graphics.zoom;
    Graphics.viewport.scale.y = Graphics.zoom;
}`

That's actually all things

ziarmandhost avatar Jul 14 '21 12:07 ziarmandhost

This looks correct. Where's your follow command?

davidfig avatar Jul 17 '21 14:07 davidfig

This looks correct. Where's your follow command?

Its my onLoaded listener. I call this listener when all resources loaded, just in that case

ziarmandhost avatar Jul 17 '21 16:07 ziarmandhost

maybe pixi-culling make it bugged?

ziarmandhost avatar Jul 17 '21 16:07 ziarmandhost

I'm not sure how pixi-cull would impact the follow. All pixi-cull does it change the visible flag, which pixi-viewport does not use. Hmm....can you console.log both the viewport.position (or viewport.center) and camera.position and see what happens?

davidfig avatar Jul 17 '21 16:07 davidfig