Better image expanding repositioning.
Images that get unsquashed have their .top changed, so it should adjust to that too.
This commit is contained in:
parent
46a23974b9
commit
e4f428efeb
@ -3271,16 +3271,14 @@ ImageExpand =
|
|||||||
completeExpand: (post) ->
|
completeExpand: (post) ->
|
||||||
{thumb} = post.file
|
{thumb} = post.file
|
||||||
return unless $.hasClass thumb, 'expanding' # contracted before the image loaded
|
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'
|
$.addClass post.nodes.root, 'expanded-image'
|
||||||
$.rmClass post.file.thumb, 'expanding'
|
$.rmClass post.file.thumb, 'expanding'
|
||||||
if rect.top + rect.height <= 0
|
return unless prev.top + prev.height <= 0
|
||||||
root = if $.engine is 'webkit'
|
root = if $.engine is 'webkit' then d.body else doc
|
||||||
d.body
|
curr = post.nodes.root.getBoundingClientRect()
|
||||||
else
|
root.scrollTop += curr.height - prev.height + curr.top - prev.top
|
||||||
doc
|
|
||||||
root.scrollTop += post.nodes.root.clientHeight - rect.height
|
|
||||||
post.file.isExpanded = true
|
|
||||||
|
|
||||||
error: ->
|
error: ->
|
||||||
post = Get.postFromNode @
|
post = Get.postFromNode @
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user