forked from 0x2620/oxjs
various focus/selection fixes
This commit is contained in:
parent
a7a3f167c9
commit
ed4f7f0c2d
4 changed files with 15 additions and 9 deletions
|
|
@ -140,7 +140,6 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
})
|
||||
.bindEvent({
|
||||
select: function(data) {
|
||||
Ox.print('SELECT >>> ', data)
|
||||
if (!data.id && self.options.selected && Ox.getObjectById(self.options.items, self.options.selected).event) {
|
||||
// only deselect annotation if the event deselect was not
|
||||
// caused by switching to an annotation without event
|
||||
|
|
@ -246,6 +245,10 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
);
|
||||
|
||||
self.options.selected && setTimeout(function() {
|
||||
// need timeout in order to trigger events
|
||||
if (self.options.collapsed) {
|
||||
self.$panel.options({collapsed: false});
|
||||
}
|
||||
selectAnnotation({id: self.options.selected});
|
||||
}, 0);
|
||||
|
||||
|
|
@ -435,6 +438,10 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
|
||||
function toggleLayer() {
|
||||
self.options.collapsed = !self.options.collapsed;
|
||||
if (self.options.collapsed) {
|
||||
self.editing && that.blurItem();
|
||||
self.$annotations.loseFocus();
|
||||
}
|
||||
that.triggerEvent('togglelayer', {collapsed: self.options.collapsed});
|
||||
}
|
||||
|
||||
|
|
@ -484,7 +491,6 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
self.editing = false;
|
||||
}
|
||||
if (value && self.options.collapsed) {
|
||||
Ox.print('HELLO??')
|
||||
self.$panel.options({collapsed: false});
|
||||
}
|
||||
self.$annotations.options({selected: value});
|
||||
|
|
@ -514,6 +520,7 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
Ox.print('FOLDER ADD ITEM', item)
|
||||
var pos = 0;
|
||||
self.options.items.splice(pos, 0, item);
|
||||
self.$panel.options({collapsed: false});
|
||||
self.$annotations
|
||||
.addItem(pos, item)
|
||||
.options({selected: item.id})
|
||||
|
|
@ -532,6 +539,7 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
|
||||
that.editItem = function() {
|
||||
self.editing = true;
|
||||
self.$panel.options({collapsed: false});
|
||||
self.$annotations.editItem();
|
||||
return that;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue