Add some scrolling to the Thumbnail bar.
This commit is contained in:
parent
f07a0a1694
commit
209154d905
@ -6665,11 +6665,14 @@
|
||||
return cb();
|
||||
},
|
||||
open: function(e) {
|
||||
var el, img, name, nodes;
|
||||
var el, img, name, nodes, rect, top;
|
||||
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if (!this) {
|
||||
return;
|
||||
}
|
||||
nodes = Gallery.nodes;
|
||||
name = nodes.name;
|
||||
if (el = $('.gal-highlight', Gallery.thumbs)) {
|
||||
@ -6685,7 +6688,16 @@
|
||||
nodes.count.textContent = +this.dataset.id + 1;
|
||||
nodes.current = img;
|
||||
nodes.frame.scrollTop = 0;
|
||||
return nodes.current.focus();
|
||||
nodes.current.focus();
|
||||
rect = this.getBoundingClientRect();
|
||||
top = rect.top;
|
||||
if (top > 0) {
|
||||
top += rect.height - doc.clientHeight;
|
||||
if (top < 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
return nodes.thumbs.scrollTop += top;
|
||||
},
|
||||
image: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
@ -6650,11 +6650,14 @@
|
||||
return cb();
|
||||
},
|
||||
open: function(e) {
|
||||
var el, img, name, nodes;
|
||||
var el, img, name, nodes, rect, top;
|
||||
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if (!this) {
|
||||
return;
|
||||
}
|
||||
nodes = Gallery.nodes;
|
||||
name = nodes.name;
|
||||
if (el = $('.gal-highlight', Gallery.thumbs)) {
|
||||
@ -6670,7 +6673,16 @@
|
||||
nodes.count.textContent = +this.dataset.id + 1;
|
||||
nodes.current = img;
|
||||
nodes.frame.scrollTop = 0;
|
||||
return nodes.current.focus();
|
||||
nodes.current.focus();
|
||||
rect = this.getBoundingClientRect();
|
||||
top = rect.top;
|
||||
if (top > 0) {
|
||||
top += rect.height - doc.clientHeight;
|
||||
if (top < 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
return nodes.thumbs.scrollTop += top;
|
||||
},
|
||||
image: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Gallery =
|
||||
init: ->
|
||||
return if g.VIEW is 'catalog' or g.BOARD is 'f' or !Conf['Gallery']
|
||||
|
||||
|
||||
el = $.el 'a',
|
||||
href: 'javascript:;'
|
||||
id: 'appchan-gal'
|
||||
@ -58,7 +58,7 @@ Gallery =
|
||||
next: '.gal-image a'
|
||||
current: '.gal-image img'
|
||||
}
|
||||
|
||||
|
||||
menuButton = $ '.menu-button', dialog
|
||||
nodes.menu = new UI.Menu 'gallery'
|
||||
|
||||
@ -135,9 +135,11 @@ Gallery =
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
cb()
|
||||
|
||||
|
||||
open: (e) ->
|
||||
e.preventDefault() if e
|
||||
return unless @
|
||||
|
||||
{nodes} = Gallery
|
||||
{name} = nodes
|
||||
|
||||
@ -155,6 +157,15 @@ Gallery =
|
||||
nodes.frame.scrollTop = 0
|
||||
nodes.current.focus()
|
||||
|
||||
# Scroll
|
||||
rect = @getBoundingClientRect()
|
||||
{top} = rect
|
||||
if top > 0
|
||||
top += rect.height - doc.clientHeight
|
||||
return if top < 0
|
||||
|
||||
nodes.thumbs.scrollTop += top
|
||||
|
||||
image: (e) ->
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user