revert annotation max height calculation
This commit is contained in:
parent
405cb1029d
commit
4cd8560312
2 changed files with 3 additions and 44 deletions
|
@ -71,18 +71,10 @@ function timeupdate(event) {
|
||||||
var ain = parseFloat(annot.dataset.in)
|
var ain = parseFloat(annot.dataset.in)
|
||||||
var aout = parseFloat(annot.dataset.out)
|
var aout = parseFloat(annot.dataset.out)
|
||||||
if (ain <= currentTime && aout > currentTime) {
|
if (ain <= currentTime && aout > currentTime) {
|
||||||
if (annot.classList.contains('single')) {
|
|
||||||
annot.style.opacity = '1'
|
|
||||||
} else {
|
|
||||||
annot.style.display = ''
|
annot.style.display = ''
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (annot.classList.contains('single')) {
|
|
||||||
annot.style.opacity = '0'
|
|
||||||
} else {
|
} else {
|
||||||
annot.style.display = 'none'
|
annot.style.display = 'none'
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -141,11 +133,6 @@ function formatInfo(config, ascroll) {
|
||||||
}
|
}
|
||||||
title.onclick = event => {
|
title.onclick = event => {
|
||||||
section.style.display = section.style.display == "none" ? "block" : "none"
|
section.style.display = section.style.display == "none" ? "block" : "none"
|
||||||
if (section.style.display == "block") {
|
|
||||||
section.querySelectorAll("pandora-scroll").forEach(ps => {
|
|
||||||
ps.updateAnnotationHeight()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
div.querySelectorAll("h3.toggle").forEach(other => {
|
div.querySelectorAll("h3.toggle").forEach(other => {
|
||||||
if (other != title) {
|
if (other != title) {
|
||||||
var osection = other.nextElementSibling
|
var osection = other.nextElementSibling
|
||||||
|
@ -422,7 +409,6 @@ function renderSingleMode(config) {
|
||||||
config.root.appendChild(div)
|
config.root.appendChild(div)
|
||||||
var frame = div.querySelector('.frame')
|
var frame = div.querySelector('.frame')
|
||||||
var text = div.querySelector('.text')
|
var text = div.querySelector('.text')
|
||||||
text.style.position = 'relative'
|
|
||||||
var first = config.annotations[0]
|
var first = config.annotations[0]
|
||||||
if (text && first) {
|
if (text && first) {
|
||||||
var color1 = `hsl(${first.color1.hue}, 60%, 15%)`
|
var color1 = `hsl(${first.color1.hue}, 60%, 15%)`
|
||||||
|
@ -441,28 +427,13 @@ function renderSingleMode(config) {
|
||||||
values = values.join('<br><br>')
|
values = values.join('<br><br>')
|
||||||
var annot = document.createElement('div')
|
var annot = document.createElement('div')
|
||||||
annot.classList.add('annotation')
|
annot.classList.add('annotation')
|
||||||
annot.classList.add('single')
|
|
||||||
annot.innerHTML = values
|
annot.innerHTML = values
|
||||||
//console.log(clip)
|
//console.log(clip)
|
||||||
annot.dataset['in'] = clip.annotations[0]['in']
|
annot.dataset['in'] = clip.annotations[0]['in']
|
||||||
annot.dataset['out'] = clip.annotations[0]['out']
|
annot.dataset['out'] = clip.annotations[0]['out']
|
||||||
annot.style.opacity = '0'
|
annot.style.display = 'none'
|
||||||
annot.style.position = 'absolute'
|
|
||||||
text.appendChild(annot)
|
text.appendChild(annot)
|
||||||
})
|
})
|
||||||
if (config.annotations.length) {
|
|
||||||
text.style.height = '72px';
|
|
||||||
}
|
|
||||||
setTimeout(() => {
|
|
||||||
var height = 0
|
|
||||||
text.querySelectorAll('.annotation.single').forEach(annotation => {
|
|
||||||
var rect = annotation.getBoundingClientRect()
|
|
||||||
if (rect.height > height) {
|
|
||||||
height = rect.height
|
|
||||||
}
|
|
||||||
})
|
|
||||||
text.style.height = height + 'px';
|
|
||||||
}, 50)
|
|
||||||
if (frame) {
|
if (frame) {
|
||||||
updatePlayer(config.video, frame, config['in'], config['out'], src, config)
|
updatePlayer(config.video, frame, config['in'], config['out'], src, config)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,18 +29,6 @@ class PandoraScroll extends HTMLElement {
|
||||||
video.muted = true
|
video.muted = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.updateAnnotationHeight = function() {
|
|
||||||
var height = 0
|
|
||||||
var text = shadow.querySelector('.text')
|
|
||||||
text.querySelectorAll('.annotation.single').forEach(annotation => {
|
|
||||||
var rect = annotation.getBoundingClientRect()
|
|
||||||
console.log(annotation, rect.height)
|
|
||||||
if (rect.height > height) {
|
|
||||||
height = rect.height
|
|
||||||
}
|
|
||||||
})
|
|
||||||
text.style.height = height + 'px';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue