Improve performances when expanding all images and they were already loaded.

This commit is contained in:
Nicolas Stepien 2013-03-30 21:37:37 +01:00
parent d4a0af9e21
commit 53ab332406

View File

@ -3272,12 +3272,13 @@ ImageExpand =
return unless $.hasClass thumb, 'expanding' # contracted before the image loaded
prev = post.nodes.root.getBoundingClientRect()
post.file.isExpanded = true
$.addClass post.nodes.root, 'expanded-image'
$.rmClass post.file.thumb, 'expanding'
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
$.queueTask ->
$.addClass post.nodes.root, 'expanded-image'
$.rmClass post.file.thumb, 'expanding'
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 @