Closed tmcw closed 13 years ago
Trust your instincts from the first sentence :)
I'd leave it out of core for sure, that's why the input handlers are pluggable. But yeah, it seems to be in line with expectations on mobile so once you have the framerate high enough (CSS transform work looking good) then go for it!
So easing in core makes sense, because ideally we can use a more performant technique than just running moves like crazy - inertia doesn't, and could live in Wax or wherever.
Running moves like crazy should be fast. If it's not, that's where the work should be done. Canned easing only gets you so far because you can't predict what kinds of transitions your users are going to ask for... or your developers :)
Granted, when you're using CSS transforms there's a performance boost that's worth working for, so having a special update that keeps overlays in sync is a good idea. But otherwise my experience with MM and Polymaps so far has been that it's better not to defer work but rather to optimize the main loop to make sure work never builds up too much and make sure the map is always in a useful state. Did @migurski induct you into the Continuous World of Dungeon Siege cult yet? http://scottbilas.com/files/2003/gdc_san_jose/continuous_world_paper.pdf :)
These principles are definitely open to challenge/change, by the way, I'm just outlining where some of the architectural decisions came from. For example, only loading a few tiles at a time is so that during dragging you don't need to cancel loads (which isn't possible in all browsers, once img.src is set) and can immediately promote desired tiles to the front of the queue.
However, I see good progress being made by @bentomas on locking tiles during animation in polymaps, so I'm ready to be wrong :) ... again, my test case for this is the zoompan stuff, where every frame is neither a plain zoom or a plain pan. It's really hard to optimize those cases with CSS transforms alone, because without loading some intermediate tiles you lose continuity really quickly.
On the subject of inertia, I prefer what would usually be called momentum. ie actions are immediate and directly proportional to user input (there's no sloppy/swooshy feeling, unlike seadragon for example). But when actions stop a little bit of follow through is nice, so you can flick the map or whatever. I definitely find that frustrating with mouse input but it's awesome with touch.
You're right - reading the Continuous World of Dungeon Siege and closing this issue: I'll incubate some easing stuff in this project
My main instinct was that css transitions would be faster than external javascript, but I think with getAnimationFrame internally, we should be fine.
It's definitely feature-creep, and most implementations are kind of annoying. But it might make sense on mobile, and is worth a shot.