Hello everyone. I'm switching from a 'homemade' map of Germany to an SVG version. Everything works fine - the only problem: When hovering with the mouse, I change the color of the outlines. To ensure that this is clearly visible and not possibly obscured by other federal states, I change the Z-order in the SVG and bring the active state to the front. However, this results in the 'landlocked' states Bremen and Berlin being inaccessible, as they are located within the shapes of Brandenburg and Lower Saxony, respectively, and are effectively surrounded by them. I'd like to solve this problem without using additional Hype elements or the like - just within the code/SVG. You can find the corresponding function in dpa_initMap() in the mouseover event listener definition. Many thanks in advance!
Solution #1 β Don't use borders. Change the background color of the state. The borders might be easier to do with inner stroke, but that seems to be a problem with SVG shapes on the webβ¦ https://caniuse.com/?search=stroke-alignment
Solution #2 β Double your graphic. On a second overlaying SVG image, that ignores mouse events, only borders could be displayed. (Downside: more HTML!)
Solution #3 β Tiered Z-order β The inner states could have an !important inline z-index value, like 100. Then, on mouse over, change the z-index to 50. The inner states merely laugh at the feeble attempt to change the z-index.
It's not very elegant code-wise, but would the viewer even notice?
This is not my preferred solution, but apparently you're hitting a problem with web design.
βββββββββ Tiny "Landlocked" state ββββ z-index 100 !important
ββββββ Selected State ββββββββββββ z-index 50
βββ Other States ββββββββββββββββ z-index 1
Since the center states don't block view of the larger states, those βlandlockedβ state can always be on topβ¦
style="z-index: 100;"
You might not even need⦠!important
Basically, you're having to change the z-index because the states overlap each other on the borders. However, those landlocked states are in the middle. They have no such overlap. They can be at a higher z-index all the time β yes / no?
This on my M1 Mac, so I suspected that the the dpa_startTooltip() mouse move code and looked for an alternative to get your tooltip to follower the cursor.
This does it by replacing the cursor with the tooltip element.
The one thing about using a custom element it seems is the element scales down.
After a lot of trying in code it to get the scale back I finally managed to increase the size of the tooltip element and font size using the normal hype ways in the inspector. go figure?.
Also increased the padding in the css.
The newCursor() function runs on scene load.
The dpa_startTooltip() is not used.
This works really well and no artefacts and much crisper.
Wow! That's really great. Thanks a million Mark for your help! Simply invaluable!! The map works like a charm now!
Maybe all you need to do is add this after line 63
ThatΒ΄s exactly, what I was looking for.
But I noticed a lot of artefacts with the tooltip.
Yes, that's an effect that apparently only occurs in Safari. I experienced something similar on the iPhone - in that case it happened when symbols were moved that contained elements with shadows. I was able to fix this by adjusting the bounding-box of the symbol which was apparently to small...
The newCursor() function runs on scene load.
The dpa_startTooltip() is not used
And - wow! again!! That's a really clear, well-organized code. I've always struggled with the MouseOver...
Here you can see the preliminary version, including the mobile variant.