Skip to content

Commit

Permalink
Ditching flipper interactive mode complexity.
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph committed Jan 15, 2013
1 parent 5456806 commit 270986f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 53 deletions.
44 changes: 3 additions & 41 deletions src/flippers/slider.js
Expand Up @@ -30,10 +30,6 @@ Monocle.Flippers.Slider = function (reader) {


function listenForInteraction(panelClass) {
// BROWSERHACK: Firstly, prime interactiveMode for buggy iOS WebKit.
interactiveMode(true);
interactiveMode(false);

if (typeof panelClass != "function") {
panelClass = k.DEFAULT_PANELS_CLASS;
if (!panelClass) {
Expand All @@ -52,13 +48,6 @@ Monocle.Flippers.Slider = function (reader) {
}


// A panel can call this with true/false to indicate that the user needs
// to be able to select or otherwise interact with text.
function interactiveMode(bState) {
p.reader.dispatchEvent('monocle:interactive:'+(bState ? 'on' : 'off'));
}


function getPlace(pageDiv) {
pageDiv = pageDiv || upperPage();
return pageDiv.m ? pageDiv.m.place : null;
Expand Down Expand Up @@ -249,39 +238,13 @@ Monocle.Flippers.Slider = function (reader) {

function afterGoingForward() {
var up = upperPage(), lp = lowerPage();
if (p.interactive) {
// set upper (off screen) to current
setPage(
up,
getPlace().getLocus({ direction: k.FORWARDS }),
function () {
// move upper back onto screen, then set lower to next and reset turn
jumpIn(up, function () { prepareNextPage(announceTurn); });
}
);
} else {
flipPages();
jumpIn(up, function () { prepareNextPage(announceTurn); });
}
flipPages();
jumpIn(up, function () { prepareNextPage(announceTurn); });
}


function afterGoingBackward() {
if (p.interactive) {
// set lower page to current
setPage(
lowerPage(),
getPlace().getLocus(),
function () {
// flip lower to upper
flipPages();
// set lower to next and reset turn
prepareNextPage(announceTurn);
}
);
} else {
announceTurn();
}
announceTurn();
}


Expand Down Expand Up @@ -476,7 +439,6 @@ Monocle.Flippers.Slider = function (reader) {

// OPTIONAL API - WILL BE INVOKED (WHERE RELEVANT) IF PROVIDED.
API.visiblePages = visiblePages;
API.interactiveMode = interactiveMode;

initialize();

Expand Down
6 changes: 0 additions & 6 deletions src/panels/imode.js
Expand Up @@ -86,9 +86,6 @@ Monocle.Panels.IMode = function (flipper, evtCallbacks) {
p.reader.showControl(p.toggleIcon);

p.interactive = true;
if (flipper.interactiveMode) {
flipper.interactiveMode(true);
}
}


Expand All @@ -110,9 +107,6 @@ Monocle.Panels.IMode = function (flipper, evtCallbacks) {
p.reader.hideControl(p.toggleIcon);

p.interactive = false;
if (flipper.interactiveMode) {
flipper.interactiveMode(false);
}
}


Expand Down
4 changes: 0 additions & 4 deletions src/panels/marginal.js
Expand Up @@ -27,10 +27,6 @@ Monocle.Panels.Marginal = function (flipper, evtCallbacks) {
}
}
setWidths();

if (flipper.interactiveMode) {
flipper.interactiveMode(true);
}
}


Expand Down
2 changes: 0 additions & 2 deletions test/events/index.html
Expand Up @@ -87,8 +87,6 @@
listenFor('monocle:jump');
listenFor('monocle:stylesheetchanging');
listenFor('monocle:stylesheetchange');
listenFor('monocle:interactive:on');
listenFor('monocle:interactive:off');
listenFor('monocle:controlhide');
listenFor('monocle:controlshow');
listenFor('monocle:selection');
Expand Down

0 comments on commit 270986f

Please sign in to comment.