txtreader: hook up touch events to ui, implement bigger font
parent
38ef6b6a52
commit
39ac54842e
|
|
@ -125,10 +125,6 @@ function onFileSelected(file) {
|
||||||
return null; // No more lines to display
|
return null; // No more lines to display
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial display
|
|
||||||
var result = displayText(currentOffset, currentPage);
|
|
||||||
history.push({ offset: currentOffset, linesDisplayed: result.linesDisplayed });
|
|
||||||
|
|
||||||
function nextPage() {
|
function nextPage() {
|
||||||
var nextOffset = displayText(currentOffset, currentPage + 1);
|
var nextOffset = displayText(currentOffset, currentPage + 1);
|
||||||
if (nextOffset !== null) {
|
if (nextOffset !== null) {
|
||||||
|
|
@ -157,16 +153,26 @@ function onFileSelected(file) {
|
||||||
function zoom() {
|
function zoom() {
|
||||||
g.clear();
|
g.clear();
|
||||||
big = !big;
|
big = !big;
|
||||||
|
firstDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle touch events
|
function firstDraw() {
|
||||||
Bangle.on('touch', function(button) {
|
currentOffset = 0;
|
||||||
if (button === 2) { // Right side of the screen (next page)
|
currentPage = 1;
|
||||||
nextPage();
|
history = [];
|
||||||
} else if (button === 1) { // Left side of the screen (previous page)
|
|
||||||
prevPage();
|
// Initial display
|
||||||
}
|
var result = displayText(currentOffset, currentPage);
|
||||||
});
|
history.push({ offset: currentOffset, linesDisplayed: result.linesDisplayed });
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.init();
|
||||||
|
ui.prevScreen = prevPage;
|
||||||
|
ui.nextScreen = nextPage;
|
||||||
|
ui.topLeft = zoom;
|
||||||
|
firstDraw();
|
||||||
|
|
||||||
|
Bangle.on("drag", (b) => ui.touchHandler(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
showFileSelector();
|
showFileSelector();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue