优化focus事件

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