pixi-viewport
pixi-viewport copied to clipboard
Clarification needed: ensureVisible
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?
Similar issue to your other problem. ensureVisible works properly in my tests. How did you initialize the viewport?
@davidfig Also confused by this function - it appears to position, but not scale to width
and height
.
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.