fix an issue where rendering the edit menu before updating layers would cause add annotation to fail

This commit is contained in:
rlx 2012-02-17 12:18:26 +00:00
parent 3407f36d12
commit c36a3537c0

View file

@ -278,6 +278,7 @@ Ox.AnnotationPanel = function(options, self) {
if (self.options.selected) { if (self.options.selected) {
annotation = getAnnotation(self.options.selected); annotation = getAnnotation(self.options.selected);
folder = getFolder(self.options.selected); folder = getFolder(self.options.selected);
Ox.print('>>>>?', annotation, folder, self.options.selected);
key = folder.options('id'); key = folder.options('id');
type = folder.options('type'); type = folder.options('type');
value = annotation.value; value = annotation.value;
@ -454,27 +455,28 @@ Ox.AnnotationPanel = function(options, self) {
that.addItem = function(layer, item) { that.addItem = function(layer, item) {
// called from addannotation callback // called from addannotation callback
var i = Ox.getIndexById(self.options.layers, layer); var i = Ox.getIndexById(self.options.layers, layer);
renderEditMenu();
self.$folder[i].addItem(item); self.$folder[i].addItem(item);
renderEditMenu();
}; };
that.blurItem = function() { that.blurItem = function() {
self.editing = false; self.editing = false;
renderEditMenu();
getFolder(self.options.selected).blurItem(); getFolder(self.options.selected).blurItem();
renderEditMenu();
}; };
that.editItem = function() { that.editItem = function() {
self.editing = true; self.editing = true;
renderEditMenu();
getFolder(self.options.selected).editItem(); getFolder(self.options.selected).editItem();
renderEditMenu();
}; };
that.updateItem = function(id, item) { that.updateItem = function(id, item) {
// called from editannotation callback // called from editannotation callback
// on the first update of a new annotation, the id will change
self.options.selected = item.id; self.options.selected = item.id;
renderEditMenu();
getFolder(id).updateItem(id, item); getFolder(id).updateItem(id, item);
renderEditMenu();
}; };
return that; return that;