From 08334b16efb65cc4fc673510b8ff5789d0a2b1bf Mon Sep 17 00:00:00 2001 From: Kevin Ngo Date: Tue, 18 Sep 2018 01:53:05 -0700 Subject: [PATCH] fix hover state by emitting mouseleave when option is no longer active (fixes #1) --- src/components/active-color.js | 3 +++ src/index.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/active-color.js b/src/components/active-color.js index 7cd2453..6fe10fd 100644 --- a/src/components/active-color.js +++ b/src/components/active-color.js @@ -19,6 +19,9 @@ AFRAME.registerComponent('active-color', { el.setAttribute('material', 'color', this.data.color); } else { el.setAttribute('material', 'color', this.defaultColor); + if (el.components.animation__mouseleave) { + setTimeout(() => { el.emit('mouseleave', null, false); }); + } } }, }); diff --git a/src/index.html b/src/index.html index ac4dfcd..2f32af7 100644 --- a/src/index.html +++ b/src/index.html @@ -44,7 +44,7 @@ - +