moagrius / TileView

TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.
MIT License
1.46k stars 337 forks source link

how to disable redrawing? #77

Closed igor-korotenko closed 10 years ago

igor-korotenko commented 10 years ago

I'm currently developing huge wall (1024x1024) of images based on your library, It works great in small sizes, but I do not need to redraw every time when user pans wall also there is only one scale level. So my question is how to disable redrawing and "freeze" already rendered tiles on a surface while moving it, to make them always visible and do not make new requests, just feeling holes?

Thanks.

moagrius commented 10 years ago

Hi @igor-korotenko,

There's no built-in mechanism to do what you're describing. The entire purpose of a tile-based image is to minimize and reuse memory, so disabling that feature wasn't a part of the API.

I'd suggest just using a single, non-tiled image. If you need 2D scrolling, put it inside a ZoomPanLayout - if you don't need scaling, just setScaleLimits( 1, 1 ); to suppress pinch gestures.

HTH, post back if you have any other questions.

igor-korotenko commented 10 years ago

Hi @moagrius , thanks for your answer. May be you can advice something that I could change in you code to achieve that behaviour? Concerning zoom level limit, I've already tried this, but no effect: pinch gesture had been working. I didn't checked why, but seems that this doesn't work.

Thanks.

moagrius commented 10 years ago

While I wouldn't recommend it, you could just modify TileManager.cleanup, where tiles are destroyed. You could just remove the m.destroy(); line, or everything before the TileGroup loop.

If you want to be able to pinch, you don't need to do anything else. If you want to disable scaling, then set the minnimum scale to the same value as the maximum scale with setScaleLimits.

As I said, I'd probably not even bother with tiling since there's no benefit if you're not destroying tiles - you may as well just use the full size image, and manage panning with ZoomPanLayout rather than TileView

HTH.

igor-korotenko commented 10 years ago

Thanks for fast reply. I've modified TileManager.cleanup this and it works as I expected:) But setScaleLimits(1,1) doesn't work. Surface still scales.

moagrius commented 10 years ago

try setScaleToFit( false ); in addition to setScaleLimits( 1, 1 );

igor-korotenko commented 10 years ago

Thanks, this works great!