Only change focus if none is set or if the current view is invisible.

This commit is contained in:
Jürg Lehni 2011-06-22 08:10:54 +01:00
parent 8cb6169249
commit 725499dc2e

View file

@ -421,15 +421,18 @@ var View = this.View = Base.extend({
}
function updateFocus() {
PaperScope.each(function(scope) {
for (var i = 0, l = scope.views.length; i < l; i++) {
var view = scope.views[i];
if (view.isVisible()) {
View.focused = view;
throw Base.stop;
if (!View.focused || View.focused.isInvisible()) {
// Find the first visible view in all scopes
PaperScope.each(function(scope) {
for (var i = 0, l = scope.views.length; i < l; i++) {
var view = scope.views[i];
if (view.isVisible()) {
View.focused = view;
throw Base.stop;
}
}
}
});
});
}
}
// mousemove and mouseup events need to be installed on document, not the
@ -446,6 +449,10 @@ var View = this.View = Base.extend({
scroll: updateFocus
});
DomEvent.add(window, {
load: updateFocus
});
return {
_createEvents: function() {
var view = this;