joseph / Monocle

A silky, tactile browser-based ebook JavaScript library.
http://monocle.inventivelabs.com.au
MIT License
743 stars 200 forks source link

3.0 enhancement: replacing panels with new interaction model #87

Closed joseph closed 11 years ago

joseph commented 12 years ago

The Panels approach is quite flexible for defining reader interfaces, but it does result in a few problems:

I've created a branch for prototyping the replacement — interaction-model. It's based on the retirements branch, and is slated to be one of the biggest changes in 3.0. I'm thinking we'll retire panels altogether for 3.0, so any Monocle applications that make heavy use of them might want to stay on the 2.x thread. There's an experimental test (which describes the new model) and a prototype panel called 'Magic'.

Support looks pretty good even for ancient versions of Android, Kindle, etc.

If this change is likely to be a problem for anyone, pipe up in the comments.

nigelpegg commented 12 years ago

This sounds really cool - totally agree on the interaction model.

When you say "panel-less", you mean no panel divs whatsoever? I took a quick look, and seems as though the touch event listening is now happening on the reader (for the start event) and on the pages themselves? Is that right? I'd built a prototype which follows the same interaction model as yours (swipes anywhere to flip pages directionally), but ended up using a 1-div-panel to do so.

joseph commented 12 years ago

Yup, that's right — the listener on the page margins is easy enough, but the listener on the content iframes is tricky. We need to calculate the event coordinates relative to the reader box, whereas we get the events coords relative to the iframe. There's a little hackery involved, mostly because the Android browser sucks.

Anyway, the big advantage of doing this is that you don't have to go into another interface "mode" to select text, or interact with links and video.

jlbruno commented 11 years ago

Playing around with the new interaction model, seems to work well so far. One question: should the new "magic" panels already support inline links?

Currently, clicking a link doesn't seem to follow the link, it seems to just turn the page (depending which side of the page you clicked on).

joseph commented 11 years ago

For some reason I didn't see this question. The answer is the same for all panels: you need to use the Stencil control. Take a look at the stencil test for example code.

joseph commented 11 years ago

For the 3.0 release, 'Magic' is a panel class like the others — the others haven't been removed or deprecated. But they are, I suppose, on notice.

jlbruno commented 11 years ago

Ok, my assumption with the quote from the original ticket of "the Stencil control is quite a hack" was that with 3.0 it was deprecated. My misunderstanding.

jlbruno commented 11 years ago

I was also never able to get Stencil working properly, but that might have been because of ticket #122