mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-06-06 17:51:15 -04:00
Improves event system.
This commit is contained in:
parent
34eed09537
commit
2819fd8496
9 changed files with 75 additions and 50 deletions
|
@ -111,6 +111,23 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/event'], functio
|
|||
}
|
||||
},
|
||||
|
||||
onLocationRefreshed = function (item, added, removed) {
|
||||
|
||||
var selectionChanged = false;
|
||||
|
||||
_.each(removed, function (item) {
|
||||
|
||||
if (item.$extended && item.$extended.hasClass('selected')) {
|
||||
item.$extended.removeClass('selected');
|
||||
selectionChanged = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (selectionChanged) {
|
||||
publish();
|
||||
}
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
|
@ -119,13 +136,7 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/event'], functio
|
|||
|
||||
$selectionRect.hide().appendTo('body');
|
||||
|
||||
event.sub('entry.removed', function (entry) {
|
||||
|
||||
if (entry.$extended && entry.$extended.hasClass('selected')) {
|
||||
entry.$extended.removeClass('selected');
|
||||
publish();
|
||||
}
|
||||
});
|
||||
event.sub('location.refreshed', onLocationRefreshed);
|
||||
|
||||
$document
|
||||
.on('mousedown', '.noSelection', noSelection)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue