Scrolls the three PageCanvases across the screen. @param dx Relative amount to scroll @param fullPage If true, the tree scroll to the next/previous page. If false, scrolls back to the current page
(int dx, final boolean fullPage)
| 1434 | * |
| 1435 | */ |
| 1436 | protected final void scrollPages(int dx, final boolean fullPage) { |
| 1437 | |
| 1438 | if (smoothScrolling) { |
| 1439 | dx = nonLineaScroll(dx); |
| 1440 | } |
| 1441 | |
| 1442 | currentPageCanvasPosition += dx; |
| 1443 | |
| 1444 | if (fullPage) { |
| 1445 | |
| 1446 | if (currentPageCanvasPosition >= pageCanvasPositionMax) { |
| 1447 | |
| 1448 | /* |
| 1449 | * loading prev page |
| 1450 | */ |
| 1451 | currentPageCanvasPosition = pageCanvasPositionMax; |
| 1452 | mode = MODE_PAGE_LOCKED; |
| 1453 | |
| 1454 | final Page page = chapterBooklet.getPrevPage(); |
| 1455 | |
| 1456 | if (page instanceof DummyPage) { |
| 1457 | DummyPage pd = (DummyPage)page; |
| 1458 | handleDummyPage(pd.getType(), SCROLL_BOOK_START); |
| 1459 | } |
| 1460 | |
| 1461 | if (page instanceof TextPage) { |
| 1462 | stopScrolling(); |
| 1463 | loadPrevPage(); |
| 1464 | return; |
| 1465 | } |
| 1466 | } |
| 1467 | |
| 1468 | if (currentPageCanvasPosition <= pageCanvasPositionMin) { |
| 1469 | |
| 1470 | /* |
| 1471 | * loading next page |
| 1472 | */ |
| 1473 | currentPageCanvasPosition = pageCanvasPositionMin; |
| 1474 | mode = MODE_PAGE_LOCKED; |
| 1475 | |
| 1476 | final Page page = chapterBooklet.getNextPage(); |
| 1477 | |
| 1478 | if (page instanceof DummyPage) { |
| 1479 | DummyPage pd = (DummyPage)page; |
| 1480 | handleDummyPage(pd.getType(), SCROLL_BOOK_END); |
| 1481 | } |
| 1482 | |
| 1483 | if (page instanceof TextPage) { |
| 1484 | stopScrolling(); |
| 1485 | loadNextPage(); |
| 1486 | return; |
| 1487 | } |
| 1488 | } |
| 1489 | |
| 1490 | repaint(); |
| 1491 | serviceRepaints(); |
| 1492 | |
| 1493 | } else { |
no test coverage detected