mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 06:00:56 -05:00
Only change focus if none is set or if the current view is invisible.
This commit is contained in:
parent
8cb6169249
commit
725499dc2e
1 changed files with 15 additions and 8 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue