select annotations, edit notes
This commit is contained in:
parent
943d117c89
commit
48e451572b
6 changed files with 42 additions and 20 deletions
|
|
@ -41,12 +41,23 @@ oml.ui.viewer = function() {
|
|||
|
||||
function loadAnnotations(callback) {
|
||||
annotations = JSON.parse(localStorage[item + '.annotations'] || '[]')
|
||||
annotations.forEach(function(data) {
|
||||
if (data.comments && !data.notes) {
|
||||
data.notes = data.comments
|
||||
delete data.comments
|
||||
}
|
||||
data.notes = data.notes || [];
|
||||
})
|
||||
callback && callback(annotations)
|
||||
}
|
||||
function saveAnnotations(data) {
|
||||
if (data) {
|
||||
data.created = data.created || (new Date).toISOString();
|
||||
data.comments = data.comments || [];
|
||||
if (data.comments && !data.notes) {
|
||||
data.notes = data.comments
|
||||
delete data.comments
|
||||
}
|
||||
data.notes = data.notes || [];
|
||||
annotations.push(data);
|
||||
}
|
||||
localStorage[item + '.annotations'] = JSON.stringify(annotations)
|
||||
|
|
@ -95,9 +106,11 @@ oml.ui.viewer = function() {
|
|||
oml.$ui.annotationFolder.find('#a-' + data.id).remove()
|
||||
removeAnnotation(data.id)
|
||||
} else if (event == 'selectAnnotation') {
|
||||
console.log('select', data)
|
||||
var $annotation = oml.$ui.annotationFolder.find('#a-' + data.id)
|
||||
$annotation.select()
|
||||
} else if (event == 'deselectAnnotation') {
|
||||
console.log('deselect', data)
|
||||
var $annotation = oml.$ui.annotationFolder.find('#a-' + data.id)
|
||||
$annotation.deselect()
|
||||
} else {
|
||||
that.triggerEvent(event, data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue