limit highlight to layer
This commit is contained in:
parent
03ba57f2b8
commit
8b14537dce
2 changed files with 61 additions and 14 deletions
|
|
@ -9,6 +9,7 @@ Ox.AnnotationPanel <f> Video Annotation Panel
|
|||
clickLink <f|null> click link callback
|
||||
editable <b|false> if true, annotations can be edited
|
||||
highlight <s|''> highlight given string in annotations
|
||||
highlightLayer <s|'*'> limit highlight to specific layer
|
||||
layers <a|[]> array with annotation objects
|
||||
mapSize <n|256> map size
|
||||
range <s|'all'> all, position, selection
|
||||
|
|
@ -50,6 +51,7 @@ Ox.AnnotationPanel = function(options, self) {
|
|||
enableExport: false,
|
||||
enableImport: false,
|
||||
highlight: '',
|
||||
highlightLayer: '*',
|
||||
itemName: {singular: 'video', plural: 'videos'},
|
||||
layers: [],
|
||||
mapSize: 256,
|
||||
|
|
@ -64,9 +66,11 @@ Ox.AnnotationPanel = function(options, self) {
|
|||
})
|
||||
.options(options || {})
|
||||
.update(function(key, value) {
|
||||
if (key == 'highlight') {
|
||||
if (key == 'highlight' || key == 'highlightLayer') {
|
||||
self.$folder.forEach(function($folder) {
|
||||
$folder.options({highlight: value});
|
||||
$folder.options({
|
||||
highlight: getHighlight($folder.options('id'))
|
||||
});
|
||||
});
|
||||
} else if (['in', 'out', 'position'].indexOf(key) > -1) {
|
||||
self.$folder.forEach(function($folder) {
|
||||
|
|
@ -77,7 +81,8 @@ Ox.AnnotationPanel = function(options, self) {
|
|||
} else if (key == 'selected') {
|
||||
self.options.editable && updateEditMenu();
|
||||
if (value) {
|
||||
getFolder(value).options({selected: value});
|
||||
var folder = getFolder(value)
|
||||
folder && folder.options({selected: value});
|
||||
} else {
|
||||
self.$folder.forEach(function($folder) {
|
||||
$folder.options({selected: ''});
|
||||
|
|
@ -179,6 +184,10 @@ Ox.AnnotationPanel = function(options, self) {
|
|||
return folder;
|
||||
}
|
||||
|
||||
function getHighlight(layer) {
|
||||
return Ox.contains(['*', layer], self.options.highlightLayer) ? self.options.highlight : '';
|
||||
}
|
||||
|
||||
function getLanguages() {
|
||||
return Ox.sortBy(Ox.map(Ox.unique(Ox.flatten(
|
||||
self.options.layers.map(function(layer) {
|
||||
|
|
@ -354,7 +363,7 @@ Ox.AnnotationPanel = function(options, self) {
|
|||
clickLink: self.options.clickLink,
|
||||
collapsed: !self.options.showLayers[layer.id],
|
||||
editable: self.options.editable,
|
||||
highlight: self.options.highlight,
|
||||
highlight: getHighlight(layer.id),
|
||||
id: layer.id,
|
||||
'in': self.options['in'],
|
||||
keyboard: index < 9 ? index + 1 + '' : '',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue