Get your own customer support community
 

Fix: setting new source, which is the same as the old source

Hi there,

In a project we're doing, it may happen that the same MultiScaleImage.source is set again, the image disappears. I have made a small modification to MultiScaleImage, which I would like to share here in case anyone else runs into this problem.

In case you cant use the patch further down, just search for the lines
if (_source)
{
_source = null
container.removeChildAt(0)
viewport.showAll(true)
}


and move them down, AFTER THE BLOCK (not inside) of "if (value is String) {...}"

This patch alters the position of the removal of the "old" image in the container. Currently it is done before the equality-check. This leaves the user with a blank screen in case you set the same URL again.

diff MultiScaleImage.as.0.4.2 MultiScaleImage.as
142,148d141
< if (_source)
< {
< _source = null
< container.removeChildAt(0)
< viewport.showAll(true)
< }
<
151,152c144,146
< if (String(value) === url)
< return
---
> if (String(value) === url) {
> return;
> }
171a166,172
> if (_source)
> {
> _source = null
> container.removeChildAt(0)
> viewport.showAll(true)
> }
>
 
happy I’m happy
Inappropriate?
1 person has this problem

The company marked this problem solved.


User_default_medium