Skip to content

Commit

Permalink
Add up and down switch and fix minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
mauehara committed Jul 11, 2014
1 parent 99e5594 commit abf63aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Page Switch Custom.sketchplugin
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ for (var i = 0; i < number_pages; i++) {
}

var choice = createSelect('Choose the page',options, 1)
var switch_to_index = choice[1]
[doc setCurrentPage:pages[switch_to_index]]
if (choice[0] == 1000) {
var switch_to_index = choice[1]
[doc setCurrentPage:pages[switch_to_index]]
}

10 changes: 10 additions & 0 deletions Page Switch Down.sketchplugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Switch between pages (cmd k)

var current_page = [doc currentPage]
var pages = [doc pages]
var number_pages = [pages count]

var current_page_index = [pages indexOfObject:current_page]

if (current_page_index > 0) [doc setCurrentPage:pages[current_page_index-1]]
else [doc setCurrentPage:pages[number_pages-1]]
2 changes: 1 addition & 1 deletion Page Switch.sketchplugin → Page Switch Up.sketchplugin
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Switch between pages (cmd /)
// Switch between pages (cmd l)

var current_page = [doc currentPage]
var pages = [doc pages]
Expand Down

0 comments on commit abf63aa

Please sign in to comment.