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

mobile hover problem #427

Open
MrTilllus opened this issue Jul 28, 2021 · 0 comments
Open

mobile hover problem #427

MrTilllus opened this issue Jul 28, 2021 · 0 comments

Comments

@MrTilllus
Copy link

MrTilllus commented Jul 28, 2021

hey,
i want to create a map with clickable areas and if i click one area its get dyed red and on desktop the hover is darkred. so far so good when i click the next area the first area should get back to his standart(blue and hover dark blue).
on desktop is everything ok but on mobile there i have a little problem
after first click the area gets darkred and after the second click the firtst area gets red (not blue again) and the second area gets dark red.
the problem is fixed if i click after the first click anywhere else and then click the second area but this is not the way to go

`
var newData = {
'areas': {},
'plots': {}
};

if (mapElem.attrs.fill == blue || mapElem.attrs.fill == blue_dark) {
// go through all areas and dye them blue
for (area in point_area) {
newData.areas[area] = {
attrs: {
fill: blue
},
attrsHover: {
fill: blue_dark,
},
};
newData.plots[point_area[area]] = {
attrs: {
fill: red
},
attrsHover: {
stroke: "#FFF"
},
};
}
//dye the clicked area red
newData.areas[id] = {
attrs: {
fill: red
},
attrsHover: {
fill: red_dark
},
};
newData.plots[point_area[id]] = {
attrs: {
fill: "#FFF"
},
attrsHover: {
stroke: red
},
};
}
// if the area is not blue
else {
for (area in point_area) {
newData.areas[area] = {
attrs: {
fill: blue
},
attrsHover: {
fill: blue_dark,
},
};
newData.plots[point_area[area]] = {
attrs: {
fill: red
},
attrsHover: {
stroke: "#FFF"
},
};
}
}
$(".mapcontainer").trigger('update', [{ mapOptions: newData }]);
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant