|
11 | 11 | swipeExit: false, |
12 | 12 | timeOut: "Off", |
13 | 13 | interactionBuzz: false, |
| 14 | + rememberPage: false, |
14 | 15 | }, require('Storage').readJSON("dtlaunch.json", true) || {}); |
15 | 16 |
|
16 | 17 | let s = require("Storage"); |
|
33 | 34 | s.writeJSON("launch.cache.json", launchCache); |
34 | 35 | } |
35 | 36 | let apps = launchCache.apps; |
36 | | - let page = (global.dtlaunch&&dtlaunch.handlePagePersist()) ?? |
37 | | - (parseInt(s.read("dtlaunch.page")) ?? 0); |
| 37 | + let page = 0; |
| 38 | + let initPageAppZeroth = 0; |
| 39 | + let initPageAppLast = 3; |
| 40 | + if (settings.rememberPage) { |
| 41 | + page = (global.dtlaunch&&dtlaunch.handlePagePersist()) ?? |
| 42 | + (parseInt(s.read("dtlaunch.page")) ?? 0); |
| 43 | + initPageAppZeroth = page*4; |
| 44 | + initPageAppLast = (page*4+3<apps.length-1)?page*4+3:apps.length-1;//Math.min(page*4+3, apps.length-1); // FIXME:What is fastest? |
| 45 | + } |
38 | 46 |
|
39 | | - const INIT_PAGE_APP_ZEROTH = page*4; |
40 | | - const INIT_PAGE_APP_LAST = (page*4+3<apps.length-1)?page*4+3:apps.length-1;//Math.min(page*4+3, apps.length-1); // FIXME:What is fastest? |
41 | | - for (let i = INIT_PAGE_APP_ZEROTH; i <= INIT_PAGE_APP_LAST; i++) { // Initially only load icons for the current page. |
| 47 | + for (let i = initPageAppZeroth; i <= initPageAppLast; i++) { // Initially only load icons for the current page. |
42 | 48 | if (apps[i].icon) |
43 | 49 | apps[i].icon = s.read(apps[i].icon); // should just be a link to a memory area |
44 | 50 | } |
|
106 | 112 | drawPage(page); |
107 | 113 |
|
108 | 114 | for (let i = 0; i < apps.length; i++) { // Load the rest of the app icons that were not initially. |
109 | | - if (i >= INIT_PAGE_APP_ZEROTH && i <= INIT_PAGE_APP_LAST) continue; |
| 115 | + if (i >= initPageAppZeroth && i <= initPageAppLast) continue; |
110 | 116 | if (apps[i].icon) |
111 | 117 | apps[i].icon = s.read(apps[i].icon); // should just be a link to a memory area |
112 | 118 | } |
|
0 commit comments