diff --git a/ui/bookmarks.js b/ui/bookmarks.js index c12ef810..8abbe88f 100755 --- a/ui/bookmarks.js +++ b/ui/bookmarks.js @@ -162,6 +162,11 @@ function setupBookmarks(viewer){ BOOKMARKS = fastSortGIDsByOrder(BOOKMARKS) bookmarksUpdated() }) + .on('horizontalShiftedImage', function(evt, gid, direction){ + if(shiftGIDToOrderInList(gid, direction, BOOKMARKS)){ + bookmarksUpdated() + } + }) } SETUP_BINDINGS.push(setupBookmarks) diff --git a/ui/layout.css b/ui/layout.css index 3ffed43c..75a7bca4 100755 --- a/ui/layout.css +++ b/ui/layout.css @@ -1230,11 +1230,11 @@ button:hover { } .small.viewer:not(.single-image-mode) .mark:after, .small.viewer:not(.single-image-mode) .marked.image:after { - -webkit-transform: rotate(0deg) scaleY(1.8) scaleX(1.8); - -moz-transform: rotate(0deg) scaleY(1.8) scaleX(1.8); - -o-transform: rotate(0deg) scaleY(1.8) scaleX(1.8); - -ms-transform: rotate(0deg) scaleY(1.8) scaleX(1.8); - transform: rotate(0deg) scaleY(1.8) scaleX(1.8); + -webkit-transform: rotate(0deg) scaleY(1.5) scaleX(1.5); + -moz-transform: rotate(0deg) scaleY(1.5) scaleX(1.5); + -o-transform: rotate(0deg) scaleY(1.5) scaleX(1.5); + -ms-transform: rotate(0deg) scaleY(1.5) scaleX(1.5); + transform: rotate(0deg) scaleY(1.5) scaleX(1.5); } /********************************************************* Overlay ***/ .overlay-block { diff --git a/ui/layout.less b/ui/layout.less index b2f35d18..215a9104 100755 --- a/ui/layout.less +++ b/ui/layout.less @@ -1283,7 +1283,7 @@ button:hover { .small.viewer:not(.single-image-mode) .mark:after, .small.viewer:not(.single-image-mode) .marked.image:after { - .scale(1.8); + .scale(1.5); } diff --git a/ui/lib/jli.js b/ui/lib/jli.js index b015801a..6b3500f3 100755 --- a/ui/lib/jli.js +++ b/ui/lib/jli.js @@ -728,6 +728,12 @@ function makeDeferredsQ(first){ /**************************************************** JS utilities ***/ +// return 1, -1, or 0 depending on sign of x +function sign(x){ + return (x > 0) - (x < 0) +} + + String.prototype.capitalize = function(){ return this[0].toUpperCase() + this.slice(1) } diff --git a/ui/marks.js b/ui/marks.js index 324a963b..4b2ec9e0 100755 --- a/ui/marks.js +++ b/ui/marks.js @@ -235,6 +235,30 @@ function makeMarkUpdater(img_class, mark_class, test){ } +// NOTE: this supports only shifts by one position... +function shiftGIDToOrderInList(gid, direction, list){ + var gid_o = DATA.order.indexOf(gid) + var gid_m = list.indexOf(gid) + + var a_m = gid_m + (direction == 'next' ? 1 : -1) + if(a_m < 0 || a_m >= list.length){ + return false + } + var a_gid = list[a_m] + var a_o = DATA.order.indexOf(a_gid) + + // if relative positions of cur and adjacent gids in list + // are different to that in DATA.order, then replace the gids + // in list... + if(sign(a_m - gid_m) != sign(a_o - gid_o)){ + list[a_m] = gid + list[gid_m] = a_gid + return true + } + return false +} + + /********************************************************************** * @@ -742,6 +766,11 @@ function setupMarks(viewer){ MARKED = fastSortGIDsByOrder(MARKED) marksUpdated() }) + .on('horizontalShiftedImage', function(evt, gid, direction){ + if(shiftGIDToOrderInList(gid, direction, MARKED)){ + marksUpdated() + } + }) .on('baseURLChanged', function(){ invalidateMarksCache() }) diff --git a/ui/tags.js b/ui/tags.js index e09ed5c0..5b08ff8c 100755 --- a/ui/tags.js +++ b/ui/tags.js @@ -537,6 +537,17 @@ function setupUnsortedTagHandler(viewer){ } tagsUpdated() }) + .on('horizontalShiftedImage', function(evt, gid, direction){ + var updated = false + for(var tag in TAGS){ + if(TAGS[tag].indexOf(gid) >= 0){ + updated = shiftGIDToOrderInList(gid, direction, TAGS[tag]) + } + } + if(updated){ + tagsUpdated() + } + }) } SETUP_BINDINGS.push(setupUnsortedTagHandler)