Better image expanding repositioning.

Images that get unsquashed have their .top changed, so it should adjust to that too.
This commit is contained in:
Nicolas Stepien 2013-03-30 05:08:12 +01:00
parent 46a23974b9
commit e4f428efeb

View File

@ -3271,16 +3271,14 @@ ImageExpand =
completeExpand: (post) ->
{thumb} = post.file
return unless $.hasClass thumb, 'expanding' # contracted before the image loaded
rect = post.nodes.root.getBoundingClientRect()
prev = post.nodes.root.getBoundingClientRect()
post.file.isExpanded = true
$.addClass post.nodes.root, 'expanded-image'
$.rmClass post.file.thumb, 'expanding'
if rect.top + rect.height <= 0
root = if $.engine is 'webkit'
d.body
else
doc
root.scrollTop += post.nodes.root.clientHeight - rect.height
post.file.isExpanded = true
return unless prev.top + prev.height <= 0
root = if $.engine is 'webkit' then d.body else doc
curr = post.nodes.root.getBoundingClientRect()
root.scrollTop += curr.height - prev.height + curr.top - prev.top
error: ->
post = Get.postFromNode @