Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hover legend #347

Merged
merged 2 commits into from
Nov 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions js/jquery.mapael.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,8 @@
self.elemEnter(dataTypeToElementMapping[type][id]);
} else if (type === 'legend-elem' || type === 'legend-label') {
var legendIndex = $elem.attr('data-legend-id');
if (self.legends[legendIndex] !== undefined &&
self.legends[legendIndex].elems[id] !== undefined)
{
self.elemEnter(self.legends[legendIndex].elems[id]);
}
var legendType = $elem.attr('data-legend-type');
self.elemEnter(self.legends[legendType][legendIndex].elems[id]);
}
}, self.MouseOverFilteringTO);
});
Expand Down Expand Up @@ -468,11 +465,8 @@
self.elemOut(dataTypeToElementMapping[type][id]);
} else if (type === 'legend-elem' || type === 'legend-label') {
var legendIndex = $elem.attr('data-legend-id');
if (self.legends[legendIndex] !== undefined &&
self.legends[legendIndex].elems[id] !== undefined)
{
self.elemOut(self.legends[legendIndex].elems[id]);
}
var legendType = $elem.attr('data-legend-type');
self.elemOut(self.legends[legendType][legendIndex].elems[id]);
}
});

Expand All @@ -484,12 +478,8 @@
var id = $elem.attr('data-id');
var type = $elem.attr('data-type');

if (type === 'area' || type === 'area-text') {
self.elemClick(self.areas[id]);
} else if (type === 'plot' || type === 'plot-text') {
self.elemClick(self.plots[id]);
} else if (type === 'link' || type === 'link-text') {
self.elemClick(self.links[id]);
if (dataTypeToElementMapping[type] !== undefined) {
self.elemClick(dataTypeToElementMapping[type][id]);
} else if (type === 'legend-elem' || type === 'legend-label') {
var legendIndex = $elem.attr('data-legend-id');
var legendType = $elem.attr('data-legend-type');
Expand Down Expand Up @@ -2047,6 +2037,7 @@

/*
* Set the behaviour when mouse enters element ("mouseover" event)
* It may be an area, a plot, a link or a legend element
* @param elem the map element
*/
elemEnter: function (elem) {
Expand All @@ -2064,7 +2055,7 @@
}

/* Handle tooltip init */
if (elem.options.tooltip !== undefined) {
if (elem.options && elem.options.tooltip !== undefined) {
var content = '';
// Reset classes
self.$tooltip.removeClass().addClass(self.options.map.tooltip.cssClass);
Expand Down Expand Up @@ -2132,6 +2123,7 @@

/*
* Set the behaviour when mouse leaves element ("mouseout" event)
* It may be an area, a plot, a link or a legend element
* @param elem the map element
*/
elemOut: function (elem) {
Expand All @@ -2149,7 +2141,7 @@
}

/* reset tooltip */
if (elem.options.tooltip !== undefined) {
if (elem.options && elem.options.tooltip !== undefined) {
self.$tooltip.css({
'display': 'none',
'top': -1000,
Expand All @@ -2165,6 +2157,7 @@

/*
* Set the behaviour when mouse clicks element ("click" event)
* It may be an area, a plot or a link (but not a legend element which has its own function)
* @param elem the map element
*/
elemClick: function (elem) {
Expand Down