Compare commits

...

2 commits

Author SHA1 Message Date
rlx
bb18c9155b Merge branch 'master' of code.0x2620.org:0x2620/openmedialibrary 2019-01-24 12:53:01 +05:30
rlx
1206f0c41e update annotation layout 2019-01-24 12:52:40 +05:30
4 changed files with 50 additions and 19 deletions

View file

@ -6,19 +6,28 @@ oml.ui.annotation = function(data, $iframe) {
}).addClass( }).addClass(
'OxSelectable' 'OxSelectable'
).css({ ).css({
backgroundColor: 'white',
borderBottom: '1px solid rgb(208, 208, 208)', borderBottom: '1px solid rgb(208, 208, 208)',
color: 'black', }).append(
fontFamily: 'Georgia, Palatino, DejaVu Serif, Book Antiqua, Palatino Linotype, Times New Roman, serif', Ox.Element().addClass('OxSelectable').css({
fontSize: '14px', backgroundColor: 'white',
lineHeight: '21px', color: 'black',
padding: '8px' fontFamily: 'Georgia, Palatino, DejaVu Serif, Book Antiqua, Palatino Linotype, Times New Roman, serif',
}).html(data.text).on({ fontSize: '14px',
click: function(event) { lineHeight: '21px',
$iframe.postMessage('selectAnnotation', { padding: '8px'
id: data.id }).html(data.text).on({
}) click: function(event) {
} $iframe.postMessage('selectAnnotation', {
}); id: data.id
})
}
})
).append(
Ox.ArrayEditable({
type: 'textarea'
}).css({
height: 0
})
);
return that; return that;
}; };

View file

@ -0,0 +1,10 @@
oml.ui.annotationFolder = function() {
var ui = oml.user.ui,
that = Ox.Element().css({
overflowY: 'auto',
});
return that;
};

View file

@ -3,9 +3,19 @@
oml.ui.annotationPanel = function() { oml.ui.annotationPanel = function() {
var ui = oml.user.ui, var ui = oml.user.ui,
that = Ox.Element().css({ that = Ox.SplitPanel({
overflowY: 'auto', elements: [
}); {
element: Ox.Bar({size: 16}),
size: 16
},
{
element: oml.$ui.annotationFolder = oml.ui.annotationFolder()
}
],
orientation: 'vertical'
})
return that; return that;
}; };

View file

@ -25,6 +25,8 @@ oml.ui.viewer = function() {
collapsed: !ui.showAnnotations, collapsed: !ui.showAnnotations,
collapsible: true, collapsible: true,
element: oml.$ui.annotationPanel = oml.ui.annotationPanel(), element: oml.$ui.annotationPanel = oml.ui.annotationPanel(),
resizable: true,
resize: [128, 384],
size: 256, size: 256,
tooltip: Ox._('Annotations') tooltip: Ox._('Annotations')
+ ' <span class="OxBright">' + ' <span class="OxBright">'
@ -41,7 +43,7 @@ oml.ui.viewer = function() {
if (item && item.length) { if (item && item.length) {
oml.api.get({id: item, keys: ['mediastate']}, function(result) { oml.api.get({id: item, keys: ['mediastate']}, function(result) {
if (result.data.mediastate == 'available') { if (result.data.mediastate == 'available') {
oml.$ui.annotationPanel.empty() oml.$ui.annotationFolder.empty()
if ($iframe) { if ($iframe) {
$iframe.remove() $iframe.remove()
} }
@ -53,10 +55,10 @@ 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.annotationPanel.append(oml.ui.annotation(data, $iframe)); oml.$ui.annotationFolder.append(oml.ui.annotation(data, $iframe));
} else if (event == 'removeAnnotation') { } else if (event == 'removeAnnotation') {
console.log('do it ...', data) console.log('do it ...', data)
oml.$ui.annotationPanel.find('#a-' + data.id).remove() oml.$ui.annotationFolder.find('#a-' + data.id).remove()
} else if (event == 'selectAnnotation') { } else if (event == 'selectAnnotation') {
console.log('select', data) console.log('select', data)
} else if (event == 'deselectAnnotation') { } else if (event == 'deselectAnnotation') {