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

Clarification needed: ensureVisible

Open aaronhudon-ts opened this issue 4 years ago • 3 comments

https://github.com/davidfig/pixi-viewport/blob/830e0de7f4f64f49ff61dac868040a8046a41775/src/viewport.js#L926

How is this function intended to be used? The view doesn't change after calling it. Is there another manual render call needed?

aaronhudon-ts avatar Oct 04 '19 17:10 aaronhudon-ts

Similar issue to your other problem. ensureVisible works properly in my tests. How did you initialize the viewport?

davidfig avatar Oct 06 '19 02:10 davidfig

@davidfig Also confused by this function - it appears to position, but not scale to width and height.

jasonsturges avatar Dec 17 '19 04:12 jasonsturges

I just released 4.7.0 that includes an option to change the scale: ensureVisible(x, y, width, height, resizeToFit: boolean). To use it, just call add a true as the last parameter: ensureVisible(x, y, width, height, true) and it'll internally call viewport.fit(width, height) to resize the viewport as needed.

davidfig avatar Jan 31 '20 00:01 davidfig