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

Scaling behavior #499

Closed p-lr closed 5 years ago

p-lr commented 5 years ago

Hi Mike,

It's been a long time :) I plan to update my android app which uses TileView 2, and I'm looking into the code to check that I won't miss any feature I need. So far, it's looking good. Although I noticed something strange: in the demo (the last advanced one), I can't zoom in or out and keep a point between my fingers at a fixed position. We can do this in v2. In v3, the zoom is sort of hard to control. Even the code into ScalingScrollView seems mostly taken from the former ZoomPanLayout. So at this point I don't understand why the v3 behaves differently. Any idea?

moagrius commented 5 years ago

Hey Peter! You're right, for the scaling it's currently using the framework provided pinch detector, which fails at a couple levels (note #484) - it needs to be rewritten from scratch (just the pinch-zoom piece). TBH I'm not sure when I'll get to it - I'd like to say within the next few weeks, but if your project depends on it, I can't promise. That said, I'll definitely give it more priority now that I know it'll have some impact on your project.

p-lr commented 5 years ago

Thanks Mike, i appreciate this. In the meantime, if I can be of any use (testing, investigating some bug..) don't hesitate to tell me.

moagrius commented 5 years ago

Will do, thanks Peter!

moagrius commented 5 years ago

this is fixed in v4 (i know, "v4?!" - long story)

p-lr commented 5 years ago

Really :D ? Have you been working on a private repository (because i don't see any v4 branch)?

moagrius commented 5 years ago

so i just fixed the 2 main things (the stutter in pinching, which was just an order of execution thing), and i need to fix the cached-composed tiles (it works, but can work better), but the main thing is i'm changing the namespace. i've reduced my online presence to just "moagrius". http://qozix.com just redirects to http://moagrius.com now, and my old blog http://upshots.org redirects to http://blog.moagrius.com - so yeah i'll be renaming this to com.moagrius.tileview which in semver is a breaking change so requires a major version change. also, i'm updating all the tooling around it for automated sync with bintray, and will break out ScrollView and ScalingScrollView into their own repos. so mostly just bookkeeping, with a couple minor upgrades.

p-lr commented 5 years ago

That's very good news. This was the last thing that hold me from upgrading (and also the fact that it will be quite an undertaking, as a subclassed TileView v2 and tweaked it). Anyway, i feel this will be worth it. Thanks!

p-lr commented 5 years ago

Btw, have you finished your book ?

moagrius commented 5 years ago

That's very good news. This was the last thing that hold me from upgrading (and also the fact that it will be quite an undertaking, as a subclassed TileView v2 and tweaked it). Anyway, i feel this will be worth it. Thanks!

Awesome! I'll keep you posted.

Btw, have you finished your book ?

we meet monday for the first 50%, i should be sending something along for you to review end of next week? we do have a rough cut up but it's super rough and embarrassing - if you really want a preview email me directly and i'll send you the link

p-lr commented 5 years ago

Ok I thought it was done or something like 80%. I'd like to get the preview when you feel it's the right time.

moagrius commented 5 years ago

Sent to your personal email.

moagrius commented 5 years ago

Hey Peter,

So ScrollView and related classes, like ScalingScrollView, previously known as ZoomPanLayout, are now in their own repo: https://github.com/moagrius/ScrollView

And the next version of tileview will import that from jcenter. That version is here, for now: https://github.com/moagrius/tv4. When/if everything proves out, I'll promote to jcenter and this repo (https://github.com/moagrius/TileView) will host version 4.

This also should correct any scaling jitter or jumpiness as well as maintain the focus point.

Note that these change are all still contained to their repos, and the main TileView repo (this one) has not been updated or changed at all.

Do you want to try the v4 demo out and see if that solves the issue you originally reported?

I doubt you'll want to try just yet, but you can use it in your own project - it's not in jcenter yet (to reduce confusion, for both myself, users, and bintray/jcenter) so you have to specify the repo url...

repositories {
  maven {
    url  "https://dl.bintray.com/moagrius/maven"
  }
}
dependencies {
  ...
  implementation 'com.moagrius:tileview:4.0.0'
}

(This latest has java 8 features so the importing project would need that as well).

p-lr commented 5 years ago

Hey Mike, I hope to do that today. Although I get err 404 on https://github.com/moagrius/tv4 and I don't find any relevant projet in your public project page. I think I will just evaluate the demo for now, as I can't just change the gradle dependency in my project (a lot refactor + revamp is required). But definitively, upgrading will be one of top priorities.

moagrius commented 5 years ago

Sorry was private, now public. And sure however you want to handle it is up to you. Thanks Peter

On Mon, Apr 29, 2019, 2:00 AM peterLaurence notifications@github.com wrote:

Hey Mike, I hope to do that today. Although I get err 404 on https://github.com/moagrius/tv4 and I don't find any relevant projet in your public project page. I think I will just evaluate the demo for now, as I can't just change the gradle dependency in my project (a lot refactor + revamp is required).

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

moagrius commented 5 years ago

So this is basically the ScrollView demo and the TileView demo in one: https://github.com/moagrius/tv4-combined

It's easier to debug when something shows up odd in TileView but is a problem in the ScrollView or ScalingScrollView source.

So the tv4 repo demo does a weird thing when you scale all the way down. This shows the same behavior but might be easier to debug. I'll try to make fixes here, so you can just pull changes and verify.

LMK if that doesn't make sense.

moagrius commented 5 years ago

And... there's a branch in that repo now called scale-down-jump. I've added a psuedo-hacky workaround that should make scaling pretty steady - although TBH I still see a jump when scaling all the way down, but it's now rare. If you agree this is solid except that for that behavior, I'll try to isolate that in a more elegant fashion.

TYIA

moagrius commented 5 years ago

Ok last comment for a while ;)

I've been running this for a while now on a real device and I'm not seeing jumping, stutter or loss of focal point. I think the change can be a little more elegant but I think the functionality is right. LMK what you think of scale and scroll behavior for https://github.com/moagrius/tv4-combined and if you agree I'll break them back out into repos and move the namespace to this repo (https://github.com/moagrius/TileView).

p-lr commented 5 years ago

Just tested tv4-combined repo and:

moagrius commented 5 years ago

ugh i never posted the branch. the "working" branch is scale-down-jump. sorry!!!

moagrius commented 5 years ago

oh i did post the branch a couple posts back, but it's not super obvious

from earlier yesterday:

And... there's a branch in that repo now called scale-down-jump. I've added a psuedo-hacky workaround that should make scaling pretty steady - although TBH I still see a jump when scaling all the way down, but it's now rare. If you agree this is solid except that for that behavior, I'll try to isolate that in a more elegant fashion.

were you on that branch? i believe that branch is pretty much flawless, while master does indeed exhibit the behavior you just described. even though it's a pain in the butt, i'm hoping it's just a miscommunication and you were testing master instead of the updated branch, which might mean we could still get this thing solved sooner rather than later.

again, sorry for the hassle and thanks as always for your willingness to help out.

p-lr commented 5 years ago

Yes indeed I tested the master branch (mis-read indeed, sorry). OMW to test it!

moagrius commented 5 years ago

you're the best

p-lr commented 5 years ago

scale-down-jump is 100% working for me :)

moagrius commented 5 years ago

nice! 🎉 i'll start uploading and migrating stuff tonight. i'm always glad to have you as the last line of quality control, because i know you'll never let anything less than "just right" past you.

p-lr commented 5 years ago

Haha :) thanks!

moagrius commented 5 years ago

Closing fixed in version 4