make showAnnotations sticky

This commit is contained in:
rlx 2011-08-17 15:20:43 +00:00
parent faf0a664cc
commit 724799da58
2 changed files with 19 additions and 8 deletions

View file

@ -1,16 +1,21 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript // vim: et:ts=4:sw=4:sts=4:ft=javascript
// fixme: this should be deleted!!
pandora.ui.annotations = function() { pandora.ui.annotations = function() {
var that = Ox.Element({ var that = Ox.Element({
id: 'annotations' id: 'annotations'
}) })
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(data) {
pandora.user.ui.annotationsSize = data; pandora.user.ui.annotationsSize = data;
}, },
resizeend: function(event, data) { resizeend: function(data) {
//alert('resizeend', JSON.stringify(data))
pandora.UI.set({annotationsSize: data}); pandora.UI.set({annotationsSize: data});
}, },
toggle: function(event, data) { toggle: function(data) {
//alert('toggle', JSON.stringify(data))
pandora.UI.set({showAnnotations: !data.collapsed}); pandora.UI.set({showAnnotations: !data.collapsed});
} }
}), }),

View file

@ -308,15 +308,18 @@ pandora.ui.item = function() {
video: streams, video: streams,
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}).bindEvent({ }).bindEvent({
resize: function(event, data) { resize: function(data) {
pandora.$ui.editor.options({ pandora.$ui.editor.options({
height: data height: data
}); });
}, },
togglesize: function(event, data) { resizeend: function(data) {
pandora.UI.set({annotationsSize: data});
},
togglesize: function(data) {
pandora.UI.set({videoSize: data.size}); pandora.UI.set({videoSize: data.size});
}, },
addAnnotation: function(event, data) { addAnnotation: function(data) {
Ox.print('addAnnotation', data); Ox.print('addAnnotation', data);
data.item = pandora.user.ui.item; data.item = pandora.user.ui.item;
data.value = 'Click to edit'; data.value = 'Click to edit';
@ -324,13 +327,16 @@ pandora.ui.item = function() {
pandora.$ui.editor.addAnnotation(data.layer, result.data); pandora.$ui.editor.addAnnotation(data.layer, result.data);
}); });
}, },
removeAnnotations: function(event, data) { removeAnnotations: function(data) {
pandora.api.removeAnnotations(data, function(result) { pandora.api.removeAnnotations(data, function(result) {
//fixme: check for errors //fixme: check for errors
pandora.$ui.editor.removeAnnotations(data.layer, data.ids); pandora.$ui.editor.removeAnnotations(data.layer, data.ids);
}); });
}, },
updateAnnotation: function(event, data) { toggleAnnotations: function(data) {
pandora.UI.set('showAnnotations', data.visible);
},
updateAnnotation: function(data) {
//fixme: check that edit was successfull //fixme: check that edit was successfull
pandora.api.editAnnotation(data, function(result) { pandora.api.editAnnotation(data, function(result) {
Ox.print('done updateAnnotation', result); Ox.print('done updateAnnotation', result);