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

Is there any complexity in this version of viewport compare to yy-viewport? #55

Closed navigator117 closed 6 years ago

navigator117 commented 6 years ago

I found squares in this live example shaked in my chrome browser with 'follow' option check on, but yy-viewport's demo seems work fine and smooth.

davidfig commented 6 years ago

Hmm...was the follow box near the edge? if bounce and follow are both on then it will cause shaking when near the edges since it doesn't know how to handle that condition.

If that's not it, can you share a video?

navigator117 commented 6 years ago

It's not bounce. I tried turn it off. It seems all the squares on the stage were shaking. when you zoom the stage to small square, your were find the stage is shake too.

davidfig commented 6 years ago

Do you have any plugins turned on except follow? Like decelerate? I'm trying to narrow down the problem. I've seen something similar in the past but I haven't had time to track it down.

JonDum commented 6 years ago

@davidfig I think this is what @navigator117 is getting at.

https://gfycat.com/GargantuanZigzagCottontail

I don't think it's related to just follow, but is especially noticeable on zooming. I don't use pixi-viewport but I wrote my own similar solution and have the same effect with PIXI in my app. Perhaps it's some sort of rounding issue? I have roundPixels turned off in my app and it still happens though.

davidfig commented 6 years ago

@jondum is bounce enabled on that gif? I don't see that when I'm zooming normally. It looks like the viewport is trying to keep the box in the center of the screen.

JonDum commented 6 years ago

I used the default settings. Looks like bounce is indeed set on default so then yes, bounce was set in that gif.

Tried it again with it off and I didn't see any of that jankiness. Weird.

davidfig commented 6 years ago

Were you using the mouse wheel to zoom? That would cause the jankiness with bounce since it fights you when you're not actively turning the wheel. There's less fighting between bounce and zoom when you pinch to zoom.

davidfig commented 6 years ago

@navigator117 - closing this issue. Feel free to reopen it if you're still seeing this problem and can provide more details. Thanks!