Increase timout for browser cache hits from 10ms to 100ms

At the moment, the blur effect is shown all the time when flipping back
and forth between images that have already been loaded. I believe the
code just does not have enough time to get it's job done. Even if it was
a cache hit, the very low limit of only 10ms results in all actions being
considered "long running", and the blur effect been shown.

Given the animation takes 300ms, using a very low threshold like 10ms
seems unfair. Something like 1/2 of the animation time seems more
appropriate.

Change-Id: I8d655be3830fef3f363a0942ac64c932c1e8f7f7
This commit is contained in:
Thiemo Kreuz 2019-05-18 17:36:07 +02:00 committed by Krinkle
parent 8251aa89b7
commit 550d01d231

View file

@ -447,8 +447,9 @@
this.setImage( this.ui, thumbnail, imageElement, imageWidths );
// We only animate unblurWithAnimation if the image wasn't loaded from the cache
// A load in < 10ms is considered to be a browser cache hit
if ( this.blurredThumbnailShown && loadTime > 10 ) {
// A load in < 100ms is fast enough (maybe even browser cache hit) that
// using a 300ms animation would needlessly deter from a fast experience.
if ( this.blurredThumbnailShown && loadTime > 100 ) {
this.ui.canvas.unblurWithAnimation();
} else {
this.ui.canvas.unblur();