Commit a8662f890db904f9879bfb2e9eea62e7266d7fbf

  • avatar
  • Daniel Beames <webos @dbso…er.com>
  • Thu Jan 07 06:19:26 CET 2010
app-launcher-reset-to-middle-page update for 1.3.5
  
1Name: Launcher: Reset to Middle Page
2Version: 1.3.1-27
3Author: Ian Grant
4Description: Resets the launcher when closing so that it always opens to the middle page, rather than the last page used. Obviously this works best with an odd number of pages (like the default 3). It also scrolls each page back to the top. (MIT license)
5
16--- /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js.orig Sat Dec 5 11:48:12 2009
27+++ /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js Thu Dec 3 19:42:03 2009
3@@ -183,6 +183,22 @@
8@@ -183,6 +183,25 @@
49 delete this.launchRequest;
510
611 this.removeLaunchFeedback();
1717+ var numPages=this.pagesModel.getNumPages();
1818+ var middlePage = (numPages % 2) ? (numPages - 1) / 2: numPages / 2 - 1;
1919+
20+ /* Reset launcher to middle page */
20+ /* Reset launcher to middle page - seems we need to do scrollTo AND setSnapIndex to be fully compatible with Wrap Pages */
21+ $('launcher_root').mojo.scrollTo((middlePage) * -this.kPageWidth, undefined, false, true);
22+ this.activePageIndex = Math.abs($('launcher_root').mojo.getScrollPosition().left) / this.kPageWidth;
2123+ $('launcher_root').mojo.setSnapIndex(middlePage, false);
24+ this.updatePageIndicators();
2225+
2326+ /* Jump scroll position back to top for all pages */
2427+ for (var i=0; i<numPages; i++) {
3131 },
3232
3333 onResize: function(event) {
34@@ -529,6 +545,15 @@
34@@ -529,6 +545,18 @@
3535 }
3636
3737 this.globalSearchAssistant.enable(true);
4242+ */
4343+ var middlePage = (numPages % 2) ? (numPages - 1) / 2: numPages / 2 - 1;
4444+
45+ /* Set launcher to middle page */
45+ /* Set launcher to middle page - seems we need to do scrollTo AND setSnapIndex to be fully compatible with Wrap Pages */
46+ $('launcher_root').mojo.scrollTo((middlePage) * -this.kPageWidth, undefined, false, true);
47+ this.activePageIndex = Math.abs($('launcher_root').mojo.getScrollPosition().left) / this.kPageWidth;
4648+ $('launcher_root').mojo.setSnapIndex(middlePage, false);
49+ this.updatePageIndicators();
4750 },
4851
4952 /* re-acquires the set of page elements the scroller needs to snap */