allow selecting multiple annotations to get in/out range

This commit is contained in:
j 2025-01-22 17:42:44 +05:30
parent dd8ea22d45
commit 10c78fc862

View file

@ -391,7 +391,21 @@ pandora.ui.editor = function(data) {
pandora.UI.set({videoResolution: data.resolution}); pandora.UI.set({videoResolution: data.resolution});
}, },
select: function(data) { select: function(data) {
pandora.UI.set('videoPoints.' + ui.item + '.annotation', data.id.split('/')[1] || ''); if (Ox.isArray(data.id)) {
var range = data.id.map(id => {
return getAnnotationById(id)
})
data['in'] = Ox.min(range.map(annotation => { return annotation["in"]; }))
data['out'] = Ox.max(range.map(annotation => { return annotation["out"]; }))
pandora.UI.set('videoPoints.' + ui.item, {
annotation: '',
'in': data['in'],
out: data.out,
position: ui.videoPoints[ui.item].position
})
} else {
pandora.UI.set('videoPoints.' + ui.item + '.annotation', data.id.split('/')[1] || '');
}
}, },
showentityinfo: function(data) { showentityinfo: function(data) {
pandora.URL.push('/entities/' + data.id) pandora.URL.push('/entities/' + data.id)
@ -428,6 +442,18 @@ pandora.ui.editor = function(data) {
pandora._dontSelectResult = false; pandora._dontSelectResult = false;
function getAnnotationById(id) {
var annotation
data.annotations.forEach(layer => {
layer.items.forEach(a => {
if (a.id == id) {
annotation = a
}
})
})
return annotation;
}
function updateBrowser() { function updateBrowser() {
pandora.$ui.browser.find('img[src*="/' + ui.item + '/"]').each(function() { pandora.$ui.browser.find('img[src*="/' + ui.item + '/"]').each(function() {
$(this).attr({ $(this).attr({