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

Load tiles during pinch / drag #25

Closed corsc closed 10 years ago

corsc commented 10 years ago

Please forgive me but I can find anything in the code.

Is it possible to trigger an update of the tile rendering during a pinch/drag/etc?

moagrius commented 10 years ago

sure, you can call requestRender in any event...

tileView.addTileViewEventListener(new TileViewEventListenerImplementation(){
    @Override
    public void onDrag(int x, int y){
        tileView.requestRender();
    }
});

(the above is from the top of my head and may contain syntactical errors, but should give the idea).

Performance is likely to suffer when attempting to render while dragging. Rendering should - by default - happen at the conclusion of a drag or pinch event - if that's not happening and something you're trying to solve, post back.

corsc commented 10 years ago

Thanks for the quick response, my client wanted the the tiles to load during the event so that is was more consistent with their iOS version. I will certainly give this a try.

moagrius commented 10 years ago

On most devices, the performance will never match iOS CATiledLayer, which is always, but nature, hardware accelerated. Even totally stripped down to 80 +/- lines, that just scales on pinch, the performance is noticeably worse than can be seen on a similar iOS app. There are some devices (some of the Nexus series, for example) that will come close, but I think it's mostly driven by hardware acceleration (or lack thereof). In any case, gl.

moagrius commented 10 years ago

did this work out for you? can i close this issue?

corsc commented 10 years ago

Yeah the end result was about what you said, thanks for your help

musaulker commented 10 years ago

Can we also load tiles when scale or zoom operation started? So in that case we can have different layers with different zoom levels so we can also make layers scalable?

moagrius commented 10 years ago

The TileViewEventLisenter interface and the TileViewEventListenerImplementation class allow you to react to most events that relate to TileView operations.

By default, the addDetailLevel methods handle the pretty complex operations needed to handle different tile sets, but feel free to customize at will.