优化blur事件

This commit is contained in:
Harvey committed 2020-04-16 11:38:19 +08:00
1 parent 4285201fa9
commit 51bde726ae
1 file changed
+2 -2
+2 -2
View File
@@ -1,10 +1,10 @@
export default function clickInit(art, events) { export default function clickInit(art, events) {
const { $player } = art.template; const { $player } = art.template;
events.proxy(document, ['click', 'contextmenu'], event => { events.proxy(document, ['click', 'contextmenu'], (event) => {
if (event.composedPath && event.composedPath().indexOf($player) > -1) { if (event.composedPath && event.composedPath().indexOf($player) > -1) {
art.isFocus = true; art.isFocus = true;
art.emit('focus'); art.emit('focus');
} else { } else if (art.isFocus) {
art.isFocus = false; art.isFocus = false;
art.emit('blur'); art.emit('blur');
} }