various focus/selection fixes

This commit is contained in:
j 2012-01-27 23:58:44 +05:30
parent a7a3f167c9
commit ed4f7f0c2d
4 changed files with 15 additions and 9 deletions

View file

@ -45,7 +45,6 @@ Ox.Focus = (function() {
index > -1 && stack.splice(index, 1);
stack.push(id);
if (stack.length > 1) {
Ox.print('...', Object.keys(Ox.UI.elements[stack[stack.length - 2]]))
Ox.UI.elements[stack[stack.length - 2]]
.removeClass('OxFocus')
.triggerEvent('losefocus')

View file

@ -849,22 +849,22 @@ Ox.TextList = function(options, self) {
width: width
})
.bind({
blur: submit,
mousedown: function(e) {
// keep mousedown from reaching list
e.stopPropagation();
}
},
})
.bindEvent({
blur: submit,
cancel: submit,
submit: submit
})
.appendTo($cell);
//.focusInput(true);
setTimeout($input.focusInput, 0); // fixme: strange
function submit() {
var value = $input.value();
//$input.loseFocus().remove();
// fixme: leaky, inputs remain in focus stack
$input.remove();
$cell.removeClass('OxEdit')
.css({
// account for padding

View file

@ -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;
};

View file

@ -210,7 +210,6 @@ Ox.VideoEditor = function(options, self) {
// the following is needed to determine
// how to handle annotation input blur
if (self.editing) {
Ox.print('FOCUSED')
self.focused = true;
setTimeout(function() {
// annotation folder will gain focus on blur
@ -397,7 +396,7 @@ Ox.VideoEditor = function(options, self) {
{key: 'S', action: 'Select Current Annotation'},
{key: 'E', action: 'Edit Selected Annotation'},
{key: Ox.UI.symbols['return'], action: 'Submit'},
{key: Ox.UI.symbols.escape, action: 'Cancel'},
{key: Ox.UI.symbols.escape, action: 'Cancel'}
].forEach(function(shortcut) {
self.$keyboardShortcuts.append(
$('<div>').css({display: 'table-row'})