forked from 0x2620/pandora
dont wait for server adding new annotations
This commit is contained in:
parent
256dcd956d
commit
caf8630d61
2 changed files with 32 additions and 26 deletions
|
@ -516,9 +516,9 @@
|
||||||
"user": {
|
"user": {
|
||||||
"level": "guest",
|
"level": "guest",
|
||||||
"ui": {
|
"ui": {
|
||||||
"annotationsCalendarSize": 192,
|
"annotationsCalendarSize": 128,
|
||||||
"annotationsFont": "small",
|
"annotationsFont": "small",
|
||||||
"annotationsMapSize": 192,
|
"annotationsMapSize": 128,
|
||||||
"annotationsRange": "position",
|
"annotationsRange": "position",
|
||||||
"annotationsSize": 256,
|
"annotationsSize": 256,
|
||||||
"annotationsSort": "position",
|
"annotationsSort": "position",
|
||||||
|
|
|
@ -271,17 +271,16 @@ pandora.ui.item = function() {
|
||||||
}).bindEvent({
|
}).bindEvent({
|
||||||
addannotation: function(data) {
|
addannotation: function(data) {
|
||||||
Ox.Log('', 'addAnnotation', data);
|
Ox.Log('', 'addAnnotation', data);
|
||||||
pandora.api.addAnnotation({
|
//async to not capture keyboard input
|
||||||
'in': data['in'],
|
setTimeout(function() {
|
||||||
item: pandora.user.ui.item,
|
pandora.$ui.editor.addAnnotation(data.layer, {
|
||||||
layer: data.layer,
|
duration: data.out - data['in'],
|
||||||
out: data.out,
|
editable: true,
|
||||||
value: data.value,
|
id: '_' + Ox.uid(),
|
||||||
}, function(result) {
|
'in': data['in'],
|
||||||
// fixme: both should come from backend
|
out: data.out,
|
||||||
result.data.duration = result.data.out - result.data['in'];
|
value: '',
|
||||||
result.data.editable = true;
|
});
|
||||||
pandora.$ui.editor.addAnnotation(data.layer, result.data);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
annotationsfont: function(data) {
|
annotationsfont: function(data) {
|
||||||
|
@ -317,19 +316,26 @@ pandora.ui.item = function() {
|
||||||
},
|
},
|
||||||
editannotation: function(data) {
|
editannotation: function(data) {
|
||||||
Ox.Log('', 'editAnnotation', data);
|
Ox.Log('', 'editAnnotation', data);
|
||||||
//fixme: check that edit was successfull
|
function callback(result) {
|
||||||
pandora.api.editAnnotation({
|
Ox.Log('', 'editAnnotation result', result);
|
||||||
id: data.id,
|
pandora.$ui.editor.updateAnnotation(data.id, result.data);
|
||||||
'in': data['in'],
|
};
|
||||||
out: data.out,
|
if (data.id[0] == '_') {
|
||||||
value: data.value,
|
pandora.api.addAnnotation({
|
||||||
}, function(result) {
|
'in': data['in'],
|
||||||
Ox.print('', 'editAnnotation result', result);
|
item: pandora.user.ui.item,
|
||||||
// fixme: both should come from backend
|
layer: data.layer,
|
||||||
result.data.duration = result.data.out - result.data['in'];
|
out: data.out,
|
||||||
result.data.editable = true;
|
value: data.value
|
||||||
pandora.$ui.editor.updateAnnotation(result.data);
|
}, callback);
|
||||||
});
|
} else {
|
||||||
|
pandora.api.editAnnotation({
|
||||||
|
id: data.id,
|
||||||
|
'in': data['in'],
|
||||||
|
out: data.out,
|
||||||
|
value: data.value
|
||||||
|
}, callback);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
embedSelection: function(data) {
|
embedSelection: function(data) {
|
||||||
pandora.$ui.embedDialog && pandora.$ui.embedDialog.remove();
|
pandora.$ui.embedDialog && pandora.$ui.embedDialog.remove();
|
||||||
|
|
Loading…
Reference in a new issue