mirror of
https://github.com/nasa/openmct.git
synced 2025-06-13 12:48:14 +00:00
[Selection] Begin implementing Hover gesture
This commit is contained in:
@ -21,16 +21,27 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define(['zepto'], function ($) {
|
define(['zepto'], function ($) {
|
||||||
function HoverGesture() {
|
function HoverGesture(hoverManager) {
|
||||||
|
this.hoverManager = hoverManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
HoverGesture.prototype.apply = function (htmlElement) {
|
HoverGesture.prototype.apply = function (htmlElement) {
|
||||||
var $element = $(htmlElement);
|
var $element = $(htmlElement);
|
||||||
|
var hoverManager = this.hoverManager;
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
$(hoverManager.all()).removeClass('hovering');
|
||||||
|
$(hoverManager.top()).addClass('hovering');
|
||||||
|
}
|
||||||
|
|
||||||
function enter() {
|
function enter() {
|
||||||
|
hoverManager.add(htmlElement);
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
function leave() {
|
function leave() {
|
||||||
|
hoverManager.remove(htmlElement);
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
$element.on('mouseenter', enter);
|
$element.on('mouseenter', enter);
|
||||||
|
Reference in New Issue
Block a user