add some annotation capability

This commit is contained in:
rlx 2019-01-24 14:50:25 +05:30
parent 4810a7ee97
commit e89dc03685
2 changed files with 18 additions and 8 deletions

View file

@ -1,6 +1,12 @@
'use strict'; 'use strict';
oml.ui.annotation = function(data, $iframe) { oml.ui.annotation = function(data, $iframe) {
var $arrayEditable = Ox.ArrayEditable({
editing: true,
type: 'textarea'
}).css({
minHeight: '16px'
});
var that = Ox.Element().attr({ var that = Ox.Element().attr({
id: 'a-' + data.id id: 'a-' + data.id
}).addClass( }).addClass(
@ -22,12 +28,14 @@ oml.ui.annotation = function(data, $iframe) {
}) })
} }
}) })
).append( ).append($arrayEditable);
Ox.ArrayEditable({ that.annotate = function() {
type: 'textarea' var item = {
}).css({ id: 'note', value: '', editable: true
height: 0 }
}) $arrayEditable.addItem(0, item)
); .options({selected: item.id})
.editItem();
}
return that; return that;
}; };

View file

@ -55,7 +55,9 @@ oml.ui.viewer = function() {
console.log('got', event, data) console.log('got', event, data)
if (event == 'addAnnotation') { if (event == 'addAnnotation') {
console.log('adding', data.id) console.log('adding', data.id)
oml.$ui.annotationFolder.append(oml.ui.annotation(data, $iframe)); var $annotation = oml.ui.annotation(data, $iframe)
oml.$ui.annotationFolder.append($annotation);
$annotation.annotate();
} else if (event == 'removeAnnotation') { } else if (event == 'removeAnnotation') {
console.log('do it ...', data) console.log('do it ...', data)
oml.$ui.annotationFolder.find('#a-' + data.id).remove() oml.$ui.annotationFolder.find('#a-' + data.id).remove()