mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-14 07:41:11 +01:00
Added hideHover option to hide hover when mousing out
This commit is contained in:
parent
939baf5e9e
commit
e526784f39
1 changed files with 12 additions and 2 deletions
12
morris.js
12
morris.js
|
@ -45,7 +45,8 @@
|
||||||
hoverLabelColor: '#444',
|
hoverLabelColor: '#444',
|
||||||
hoverFontSize: 12,
|
hoverFontSize: 12,
|
||||||
smooth: true,
|
smooth: true,
|
||||||
parseTime: true
|
parseTime: true,
|
||||||
|
hideHover: false
|
||||||
};
|
};
|
||||||
|
|
||||||
Line.prototype.precalc = function() {
|
Line.prototype.precalc = function() {
|
||||||
|
@ -263,6 +264,11 @@
|
||||||
this.el.mousemove(function(evt) {
|
this.el.mousemove(function(evt) {
|
||||||
return updateHilight(evt.pageX);
|
return updateHilight(evt.pageX);
|
||||||
});
|
});
|
||||||
|
if (_this.options.hideHover) {
|
||||||
|
this.el.mouseout(function(evt) {
|
||||||
|
return hilight(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
touchHandler = function(evt) {
|
touchHandler = function(evt) {
|
||||||
var touch;
|
var touch;
|
||||||
touch = evt.originalEvent.touches[0] || evt.originalEvent.changedTouches[0];
|
touch = evt.originalEvent.touches[0] || evt.originalEvent.changedTouches[0];
|
||||||
|
@ -272,7 +278,11 @@
|
||||||
this.el.bind('touchstart', touchHandler);
|
this.el.bind('touchstart', touchHandler);
|
||||||
this.el.bind('touchmove', touchHandler);
|
this.el.bind('touchmove', touchHandler);
|
||||||
this.el.bind('touchend', touchHandler);
|
this.el.bind('touchend', touchHandler);
|
||||||
|
if (_this.options.hideHover) {
|
||||||
|
return hilight(null);
|
||||||
|
} else {
|
||||||
return hilight(0);
|
return hilight(0);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Line.prototype.createPath = function(coords, top, left, bottom, right) {
|
Line.prototype.createPath = function(coords, top, left, bottom, right) {
|
||||||
|
|
Loading…
Reference in a new issue