These are chat archives for openseadragon/openseadragon

25th
Oct 2016
Antoine Vandecreme
@avandecreme
Oct 25 2016 18:26
1000 stars :sparkles:
Ian Gilman
@iangilman
Oct 25 2016 18:28
Awesome! :beers:
John Hoffer
@thejohnhoffer
Oct 25 2016 20:25
Is there any way to trigger a redraw for a specific tile within a tiledImage?
viewer.raiseEvent('tile-drawing', {tile:magic-get-tile-function(level,xy),...})
Is there a magic-get-tile-function that can bring me the reference for a given tile within a given tiledImage?
Ian Gilman
@iangilman
Oct 25 2016 20:32
What are you trying to accomplish? You have a tile you want to change the contents of?
There's no way to redraw just one tile; you have to redraw the entire image... that's how canvas works.
... but I assume you just mean you want to update the contents of a tile and redraw the image?
How are you updating it? Loading it from the server? Or is there a client side change you make?
John Hoffer
@thejohnhoffer
Oct 25 2016 20:33
Yeah, I'll take the second option if I can't have the first.
This is a client side change.
I'm highlighting one segment of the image through webgl.
Ian Gilman
@iangilman
Oct 25 2016 20:35
Cool. Well, if you have the tile in question, you should be able to do whatever you want to its contents via tile.context2D
...and then of course you have to force a redraw, either by telling the viewer or tiledImage to do so
John Hoffer
@thejohnhoffer
Oct 25 2016 20:35
Yep- I just don't have the tile in question.
I've read though the API I swear!
Ian Gilman
@iangilman
Oct 25 2016 20:36
Yeah, unfortunately we don't really have good access to the tiles...
Let me see what would be best
John Hoffer
@thejohnhoffer
Oct 25 2016 20:37
If there were a mouseover event per tile, that would be perfect.
Ian Gilman
@iangilman
Oct 25 2016 20:38
Yeah, we don't have that and we don't have the magic-get-tile-function
...though we're certainly not against having them, if you care to add them!
What we do have, and its kind of private (not documented) is lastDrawn, which is an array of tiles in the TiledImage
...so you can do viewer.world.getItemAt(0).lastDrawn to get the array and then iterate through it looking for the one that matches the level, x, y that you want
John Hoffer
@thejohnhoffer
Oct 25 2016 20:40
Yep.
Ian Gilman
@iangilman
Oct 25 2016 20:40
...or the position/size on the screen
John Hoffer
@thejohnhoffer
Oct 25 2016 20:41
That makes the most sense.
Ian Gilman
@iangilman
Oct 25 2016 20:41
cool
John Hoffer
@thejohnhoffer
Oct 25 2016 20:41
Thank you!
Ian Gilman
@iangilman
Oct 25 2016 20:41
Sure :)
...and if you want to turn that into a TiledImage function and make a pull request, that would be cool too :)
John Hoffer
@thejohnhoffer
Oct 25 2016 20:42
I just thinking of that. I'll see if I can make it happen. I still haven't got a handle on all these coordinate systems.
Ian Gilman
@iangilman
Oct 25 2016 20:43
I know, it's a challenge!
... we wouldn't need so many if it weren't for the zooming part! ;)
...though that doesn't really go into the level, x, y part
John Hoffer
@thejohnhoffer
Oct 25 2016 20:47
I haven't seen that page- looks very helpful! So far I've only used debug mode. And yeah, I've assumed that one unit in level,x,y space is given as equal to the tileSize, which I guess means that the whole image size is roughly 1x1 units for level 0, 2x2 units for level 1, 4x4 units for level 2, etc.
Ian Gilman
@iangilman
Oct 25 2016 20:51
Well, it has to do with how the image is tiled, which is different for every format. In the case of DZI, we start at full resolution and carve it up into tiles the size of tileSize, then we scale the image down to half size and then carve it up into tiles again... these new tiles are still tileSize, so there are about 25% as many tiles at this level as there were at the level above. Then we keep scaling down and tiling all the way down to an image that's just a single pixel square. That becomes level 0, and level 1 is the 2 x 2 pixel square, level 2 is 4 x 4 (approximately of course, depending on aspect ratio), etc.
John Hoffer
@thejohnhoffer
Oct 25 2016 20:53
Yeah, the format we're using as a customTileSource starts labeling mip levels at 0 for the full resolution image- if I remember how one format works, I just remember that the other is completely the opposite. So that works out well.
Ian Gilman
@iangilman
Oct 25 2016 20:54
Perfect! ;)
John Hoffer
@thejohnhoffer
Oct 25 2016 20:57
Okay -I've got the magic-get-tile-function and the accessability patch on my plate now. I cant promise fast results since my paid position comes first, but I can promise I'll keep reaching out here with questions! Thanks again.
Ian Gilman
@iangilman
Oct 25 2016 20:58
It's all good... whatever/whenever you can do to help is great
Meanwhile, ask away :)
John Hoffer
@thejohnhoffer
Oct 25 2016 20:59
Thanks!