allow for annotation highlight if same value

This commit is contained in:
rolux 2018-10-12 14:46:38 +02:00
parent 9b3c7ddf20
commit 6eb3b0bb6f
4 changed files with 21 additions and 14 deletions

View file

@ -485,12 +485,14 @@ Ox.ArrayEditable = function(options, self) {
}; };
that.updateItemGroup = function() { that.updateItemGroup = function() {
var group = self.options.items[self.selected].group; var group = self.selected > - 1 ? self.options.items[self.selected].group : '';
self.$items.forEach(function($item, index) { self.$items.forEach(function($item, index) {
$item[ $item[
self.options.items[index].group == group ? 'addClass' : 'removeClass' self.options.highlightGroup && group
&& self.options.items[index].group == group
? 'addClass' : 'removeClass'
]('OxGroup'); ]('OxGroup');
}) });
} }
return that; return that;

View file

@ -38,7 +38,7 @@ Ox.AnnotationFolder = function(options, self) {
collapsed: false, collapsed: false,
editable: false, editable: false,
highlight: '', highlight: '',
highlightAnnotations: false, highlightAnnotations: 'none',
id: '', id: '',
'in': 0, 'in': 0,
item: '', item: '',
@ -479,7 +479,9 @@ Ox.AnnotationFolder = function(options, self) {
); );
}).map(function(item) { }).map(function(item) {
return Ox.extend(item, { return Ox.extend(item, {
group: item['in'] + '-' + item.out group: self.options.highlightAnnotations == 'none' ? ''
: self.options.highlightAnnotations == 'value' ? item.value
: item['in'] + '-' + item.out
}); });
}); });
return annotations; return annotations;
@ -650,7 +652,9 @@ Ox.AnnotationFolder = function(options, self) {
function updateAnnotations() { function updateAnnotations() {
self.annotations = getAnnotations(); self.annotations = getAnnotations();
self.$annotations.options({highlightGroup: self.options.highlightAnnotations != 'none'});
self.$annotations.options({items: self.annotations}); self.$annotations.options({items: self.annotations});
self.$annotations.updateItemGroup();
showWarnings(); showWarnings();
if (self.widget) { if (self.widget) {
self.options.type == 'event' self.options.type == 'event'
@ -746,10 +750,10 @@ Ox.AnnotationFolder = function(options, self) {
Ox.forEach(data, function(value, key) { Ox.forEach(data, function(value, key) {
item[key] = value; item[key] = value;
}); });
item.group = item['in'] + '-' + item.out; item.group = self.options.highlightAnnotations == 'none' ? ''
if (self.options.highlightAnnotations) { : self.options.highlightAnnotations == 'value' ? item.value
self.$annotations.updateItemGroup(); : item['in'] + '-' + item.out;
} self.$annotations.updateItemGroup();
if (id != item.id) { if (id != item.id) {
self.$annotations.find('.OxEditableElement').each(function() { self.$annotations.find('.OxEditableElement').each(function() {
var $element = $(this); var $element = $(this);

View file

@ -52,7 +52,7 @@ Ox.AnnotationPanel = function(options, self) {
enableExport: false, enableExport: false,
enableImport: false, enableImport: false,
highlight: '', highlight: '',
highlightAnnotations: false, highlightAnnotations: 'none',
highlightLayer: '*', highlightLayer: '*',
itemName: {singular: 'video', plural: 'videos'}, itemName: {singular: 'video', plural: 'videos'},
layers: [], layers: [],
@ -514,8 +514,9 @@ Ox.AnnotationPanel = function(options, self) {
{}, {},
{id: 'highlightannotations', title: Ox._('Highlight Annotations'), disabled: true}, {id: 'highlightannotations', title: Ox._('Highlight Annotations'), disabled: true},
{group: 'highlight', max: 1, items: [ {group: 'highlight', max: 1, items: [
{id: 'none', title: Ox._('None'), checked: !self.options.highlightAnnotations}, {id: 'none', title: Ox._('None'), checked: self.options.highlightAnnotations == 'none'},
{id: 'selection', title: Ox._('Matching Current Selection'), checked: self.options.highlightAnnotations} {id: 'value', title: Ox._('Same Value'), checked: self.options.highlightAnnotations == 'value'},
{id: 'selection', title: Ox._('Same Selection'), checked: self.options.highlightAnnotations == 'selection'}
]} ]}
] : [], ] : [],
self.languages.length > 1 ? [ self.languages.length > 1 ? [
@ -574,7 +575,7 @@ Ox.AnnotationPanel = function(options, self) {
that.options({highlightLayer: layer}); that.options({highlightLayer: layer});
that.triggerEvent('highlightlayer', self.options.highlightLayer); that.triggerEvent('highlightlayer', self.options.highlightLayer);
} else if (data.id == 'highlight') { } else if (data.id == 'highlight') {
var value = data.checked[0].id == 'selection' var value = data.checked[0].id
that.options({highlightAnnotations: value}); that.options({highlightAnnotations: value});
that.triggerEvent('highlightannotations', self.options.highlightAnnotations); that.triggerEvent('highlightannotations', self.options.highlightAnnotations);
} else { } else {

View file

@ -49,7 +49,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
var that = Ox.Element({}, self) var that = Ox.Element({}, self)
.defaults({ .defaults({
annotationsCalendarSize: 256, annotationsCalendarSize: 256,
annotationsHighlight: false, annotationsHighlight: 'none',
annotationsMapSize: 256, annotationsMapSize: 256,
annotationsRange: 'all', annotationsRange: 'all',
annotationsSeparator: ';', annotationsSeparator: ';',