GSVPano.js icon indicating copy to clipboard operation
GSVPano.js copied to clipboard

Out of sync pano reload issue

Open JohnHardy opened this issue 11 years ago • 1 comments

I've noticed that when you update the pano location in quick succession (i.e. anything which results in two composePanorama() calls before the first one completes) the images from the first one can overwrite the second one, causing a nasty shearing effect between the two locations.

The fix is simple: just add a request number to each pano, so that we can drop ones which are not relevant any more.

Variables:

_requestNumber = 0,

In the lamda for compsePanorama:

                (function (x, y, iRequest) { 
                    var img = new Image();
                    img.requestNum = iRequest;
                    img.addEventListener('load', function () {
                        self.composeFromTile(x, y, this);
                    });
                    img.crossOrigin = '';
                    img.src = url;  
                })(x, y, _requestNumber);

At the top of composeFromTile:

        // Do we need to drop this request (i.e. it is for an old pano).
        if (texture.requestNum != _requestNumber)
        {
            console.log("(EE) Pano image request number out of sync.  Dropping draw request.");
            return;
        }

Impressive library, thanks for sharing. :+1:

John

JohnHardy avatar Jun 28 '13 01:06 JohnHardy

Thanks, John. I'm working on a new version with support for the new maps services, and a few fixes. I'll add your fix as soon as possible.

spite avatar Aug 05 '13 09:08 spite