Merge branch 'fix/tall-statuses-v2' into 'develop'

More tall status related fixes that I didn't know was borkd

See merge request pleroma/pleroma-fe!498
This commit is contained in:
lambda 2019-01-30 17:47:46 +00:00
commit 0bd77149a0

View file

@ -180,7 +180,7 @@ const Status = {
return this.tallStatus return this.tallStatus
}, },
showingMore () { showingMore () {
return this.showingTall || (this.status.summary && this.expandingSubject) return (this.tallStatus && this.showingTall) || (this.status.summary && this.expandingSubject)
}, },
nsfwClickthrough () { nsfwClickthrough () {
if (!this.status.nsfw) { if (!this.status.nsfw) {
@ -316,11 +316,14 @@ const Status = {
'highlight': function (id) { 'highlight': function (id) {
if (this.status.id === id) { if (this.status.id === id) {
let rect = this.$el.getBoundingClientRect() let rect = this.$el.getBoundingClientRect()
if (rect.top < 140) { if (rect.top < 100) {
window.scrollBy(0, rect.top - 200) // Post is above screen, match its top to screen top
} else if (rect.top < window.innerHeight && rect.height >= (window.innerHeight - 50)) { window.scrollBy(0, rect.top - 100)
window.scrollBy(0, rect.top - 50) } else if (rect.height >= (window.innerHeight - 50)) {
// Post we want to see is taller than screen so match its top to screen top
window.scrollBy(0, rect.top - 100)
} else if (rect.bottom > window.innerHeight - 50) { } else if (rect.bottom > window.innerHeight - 50) {
// Post is below screen, match its bottom to screen bottom
window.scrollBy(0, rect.bottom - window.innerHeight + 50) window.scrollBy(0, rect.bottom - window.innerHeight + 50)
} }
} }