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

Zooming further than max #502

Closed gallmann closed 5 years ago

gallmann commented 5 years ago

Hello, first of all, thanks for the awesome library! I have a large image which I am displaying with Tiles. I want to be able to zoom in heaviliy into the picture (possibly as much as to see the actual pixels of the image).

Is there a way to zoom further than the maximally zoomed layer of tiles without actually providing the tiles themselves? Providing an additional layer of tiles would need to much disk space.

I tried the following: tileView.setScaleLimits(1f, 10f) but the App crashes as soon as I zoom in too far. (I only provided four layers of tiles.)

Help would be much appreciated.

moagrius commented 5 years ago

so any levels greater than 1 should not be tiled any further. let the system scale it, in which case you shouldn't have the same problems with out of memory errors. is that the error you're seeing?

for example, take the demo and set max scale to 10, without adding any more detail levels, and see how it behaves. finally, what version are you using?

gallmann commented 5 years ago

The error I am seeing is an ArrayIndexOutOfBoundsException.

java.lang.ArrayIndexOutOfBoundsException: length=10; index=-2147483648 at java.util.ArrayList.get(ArrayList.java:439) at com.qozix.tileview.TileView.determineCurrentDetail(TileView.java:287) at com.qozix.tileview.TileView.onScaleChanged(TileView.java:261) at com.qozix.widget.ScalingScrollView.setScale(ScalingScrollView.java:93) at com.qozix.widget.ScalingScrollView.setScaleFromPosition(ScalingScrollView.java:199) at com.qozix.widget.ScalingScrollView.onScale(ScalingScrollView.java:245) at android.view.ScaleGestureDetector.onTouchEvent(ScaleGestureDetector.java:372) at com.qozix.widget.ScalingScrollView.dispatchTouchEvent(ScalingScrollView.java:56)

I am using version 3.0.1. (I just cloned the Master Branch) And I added the following line to TimeViewDemoSimple.java: tileView.setScaleLimits(1f,10f); When I zoom in too far, the App crashes with the above Exception.

moagrius commented 5 years ago

I'll try to take a look this weekend

On Mon, Mar 18, 2019, 5:02 AM tschutli notifications@github.com wrote:

The error I am seeing is an ArrayIndexOutOfBoundsException.

java.lang.ArrayIndexOutOfBoundsException: length=10; index=-2147483648 at java.util.ArrayList.get(ArrayList.java:439) at com.qozix.tileview.TileView.determineCurrentDetail(TileView.java:287) at com.qozix.tileview.TileView.onScaleChanged(TileView.java:261) at com.qozix.widget.ScalingScrollView.setScale(ScalingScrollView.java:93) at com.qozix.widget.ScalingScrollView.setScaleFromPosition(ScalingScrollView.java:199) at com.qozix.widget.ScalingScrollView.onScale(ScalingScrollView.java:245) at android.view.ScaleGestureDetector.onTouchEvent(ScaleGestureDetector.java:372) at com.qozix.widget.ScalingScrollView.dispatchTouchEvent(ScalingScrollView.java:56)

I am using version 3.0.1. (I just cloned the Master Branch) And I added the following line to TimeViewDemoSimple.java: tileView.setScaleLimits(1f,10f); When I zoom in too far, the App crashes with the above Exception.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/moagrius/TileView/issues/502#issuecomment-473844812, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqzoHfM4noUqfncjZxg4fceCVwWzi7Uks5vX2Q6gaJpZM4bol9w .

p-lr commented 5 years ago

I can confirm this one. We should be able to set only the max scale:

tileView.setMaximumScale(2.0f)

As setting both min and max can be redundant if we used for example:

tileView.setMinimumScaleMode(ScalingScrollView.MinimumScaleMode.COVER)
moagrius commented 5 years ago

Got it, will do. I should be able to get some good hours in every workday this coming week (M-F)

On Sun, May 12, 2019, 1:51 AM peterLaurence notifications@github.com wrote:

I can confirm this one. We should be able to set only the max scale:

tileView.setMaximumScale(2.0f)

As setting both min and max can be redundant if we used for example:

tileView.setMinimumScaleMode(ScalingScrollView.MinimumScaleMode.COVER)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/moagrius/TileView/issues/502#issuecomment-491570090, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFLHICFOCABO5JQ4BFJFOTPU647BANCNFSM4G5CL5YA .

moagrius commented 5 years ago

@tschutli this bug should be fixed in https://github.com/moagrius/TileView/tree/issue-502, and there's an open PR at https://github.com/moagrius/TileView/pull/516.

if you want to pull the branch and verify the fix works for you, that'd be great. assuming it works, we should have this merged into master by tomorrow

gallmann commented 5 years ago

I just tested the new branch. Now it does not crash anymore. However, if I zoom in heavily (further than 2f), the image does not scale correctly. It just disappears. I tested this in the TileViewDemoAssets.java class by adding the following line:

tileView.setScaleLimits(1f,10f);

moagrius commented 5 years ago

Yep, I'm aware, there are multiple issues around scaling up, something I honestly just didn't think about during the update.

I'm aware and m working on them actively. See #518

gallmann commented 5 years ago

I see. Thanks for your efforts!

moagrius commented 5 years ago

This is fixed in the latest commit, but is not yet in a release. I hope to finish up the remaining bugs this week (hopefully in the next few days) and cut a new release. I'm going to close as fixed, but look for a version update with the fix, or just use the repo as an imported module.

Thanks for pointing this out!

moagrius commented 5 years ago

See https://github.com/moagrius/TileView/pull/520