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() {
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) {
$item[
self.options.items[index].group == group ? 'addClass' : 'removeClass'
self.options.highlightGroup && group
&& self.options.items[index].group == group
? 'addClass' : 'removeClass'
]('OxGroup');
})
});
}
return that;

View file

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

View file

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

View file

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