[Selection] Begin implementing Hover gesture

This commit is contained in:
Victor Woeltjen 2016-08-25 13:15:37 -07:00
parent 3228a83802
commit fd97f4db41

View File

@ -21,16 +21,27 @@
*****************************************************************************/
define(['zepto'], function ($) {
function HoverGesture() {
function HoverGesture(hoverManager) {
this.hoverManager = hoverManager;
}
HoverGesture.prototype.apply = function (htmlElement) {
var $element = $(htmlElement);
var hoverManager = this.hoverManager;
function update() {
$(hoverManager.all()).removeClass('hovering');
$(hoverManager.top()).addClass('hovering');
}
function enter() {
hoverManager.add(htmlElement);
update();
}
function leave() {
hoverManager.remove(htmlElement);
update();
}
$element.on('mouseenter', enter);