davidfig / pixi-viewport

A highly configurable viewport/2D camera designed to work with pixi.js
https://davidfig.github.io/pixi-viewport/
MIT License
1.06k stars 177 forks source link

Incorrect behaviour when resolution = 2 #74

Closed kektobiologist closed 5 years ago

kektobiologist commented 6 years ago

When I create a PIXI.Application with resolution = 2, the zoom behaviour of pixi-viewport is weird. Zooming doesn't happen centred on the mouse pointer but some point outside the viewport.

davidfig commented 6 years ago

Can you provide pseudo code? I haven't seen this and my resolution is rarely 1.

kektobiologist commented 6 years ago

I managed to fix it by adding interaction: app.renderer.plugins.interaction to the Viewport constructor. I only got this by looking through the code of the Live Example.

eranimo commented 6 years ago

The above workaround worked for me as well

davidfig commented 6 years ago

Double checking: were you zooming using the mouse wheel?

eranimo commented 6 years ago

Yes—that fixed the original bug but I'm having an issue where I can only zoom with the mousewheel in the top-left part of the screen.

davidfig commented 6 years ago

Ok. The fix was specific to the wheel() module, so glad it worked.

As to your other issue: are you using a full-screen viewport or only partial? Can you show me how to replicate the bug? It seems to work for me.

kektobiologist commented 6 years ago

I'm not using full screen. It's pixi default size i think which is 800x600

davidfig commented 6 years ago

The wheel is only active when the mouse is hovering over the viewport (this allows the wheel to work across multiple viewports). Is your mouse over the viewport when you're using the wheel?

kektobiologist commented 6 years ago

yes. i'll try to make a jsfiddle and then post it for better clarity

davidfig commented 5 years ago

Closing this since no response. Feel free to reopen.