These are chat archives for openseadragon/openseadragon

7th
Jun 2016
Illya Moskvin
@IllyaMoskvin
Jun 07 2016 02:51
I'm working on an image toggle for my slider. I'm getting a really odd little error where when I replace the right-hand image, the visible part gets "carbon-copied" onto the left-hand image. It then behaves as if it were part of the left-hand image all along – panning, zooming, etc.
Illya Moskvin
@IllyaMoskvin
Jun 07 2016 03:07
Here is a codepen illustrating the problem: http://codepen.io/imoskvin/pen/jrbVer?editors=0010
Please see the setTimeout call and the replaceImage function inside loadComparisonImages
Any ideas as to what might be causing it? I'll keep picking away at it, maybe I'll get lucky. :P
Illya Moskvin
@IllyaMoskvin
Jun 07 2016 03:41
Alrighty, I fixed it, but I have a feeling there might be a more elegant way to do it:
        if( rightImage ) {
            viewer.world.getIndexOfItem( rightImage );
            viewer.world.removeItem( rightImage );
            rightImage.destroy();
        }
Illya Moskvin
@IllyaMoskvin
Jun 07 2016 03:56
My apologies to anyone w/ red-green colorblindness or sensitivity to blinking images. Changed the timeout to four seconds. I think it's surprising that calling destroy on a TiledImage does not remove it from the world. Maybe I misunderstood what that method does.
Ian Gilman
@iangilman
Jun 07 2016 16:26
@IllyaMoskvin Yeah, destroy is just for cleaning up the memory used by an image after it's removed; it's actually already called by viewer.world.removeItem. I can see the confusion though! Maybe it would help to add a little to the destroy docs or something; what do you think?
Illya Moskvin
@IllyaMoskvin
Jun 07 2016 18:13
@iangilman Sounds good! Thanks for the heads-up re: removeItem, pen amended. I should have checked the source!
Ian Gilman
@iangilman
Jun 07 2016 20:02
@IllyaMoskvin Well, ideally the docs should be good enough you don't have to check the source!
@IllyaMoskvin BTW, should I add that pen to the OSD collection?