rename selection event to selectText, replace deselectAnnotation with selectAnnotation({id: null})

This commit is contained in:
j 2019-02-01 14:19:16 +05:30
commit 2c5c56c036
3 changed files with 15 additions and 16 deletions

View file

@ -71,8 +71,6 @@ oml.ui.viewer = function() {
var annotationEvents = {
change: function() {
console.log('change...')
console.log(annotations)
saveAnnotations()
},
'delete': function(data) {
@ -96,7 +94,6 @@ oml.ui.viewer = function() {
border: 0
}).onMessage(function(data, event) {
if (event == 'addAnnotation') {
console.log('adding', data.id)
saveAnnotations(data);
var $annotation = oml.ui.annotation(data, $iframe).bindEvent(annotationEvents)
oml.$ui.annotationFolder.append($annotation);
@ -105,12 +102,14 @@ oml.ui.viewer = function() {
oml.$ui.annotationFolder.find('#a-' + data.id).remove()
removeAnnotation(data.id)
} else if (event == 'selectAnnotation') {
var $annotation = oml.$ui.annotationFolder.find('#a-' + data.id)
$annotation && $annotation.select()
} else if (event == 'deselectAnnotation') {
var $annotation = oml.$ui.annotationFolder.find('#a-' + data.id)[0]
$annotation && $annotation.deselect()
} else if (event == 'selection') {
if (data.id) {
var $annotation = oml.$ui.annotationFolder.find('#a-' + data.id)
$annotation.length && $annotation.select()
} else {
var $annotation = oml.$ui.annotationFolder.find('.OMLAnnotation.selected')
$annotation.length && $annotation.deselect()
}
} else if (event == 'selectText') {
oml.$ui.annotationPanel.updateSelection(data)
} else {
console.log('got', event, data)