TownyAdvanced / MapTowny

A Towny add-on Bukkit plugin that enables towns to show up on a web-map.
MIT License
15 stars 17 forks source link

Z-Index doesn't seems to work on Dynmap #28

Closed ipiepiepie closed 1 year ago

ipiepiepie commented 1 year ago

Describe the Bug

If I understood everything correctly, then the z-index should be responsible for the order in which the layers are stacked on top of each other. So, I'm want to make new layer with MapTowny, which covers town and goes beyond its boundaries. I did it with your perfect API (it's really very easy to use, I'm impressed), but when I'm clicking on Town layer on Dynmap, I'm see my custom layer's description. I thought, that it happend because of my incorrect z-index, so I changed it, but nothing happend.. I tried many variants of z-index, I've even tried negative numbers, but it still doesn't work.

System, Java, Server and Plugin Version

System: Windows 10 Java: Java 17 (OpenJDK 64-Bit Server VM 17.0.1+12-39) Server: Paper version git-Paper-794 (MC: 1.16.5) Plugin: MapTowny-2.0.0 Towny Version: Towny-0.98.2.0 Dynmap Version: Dynmap-3.4-beta-4-spigot

Screenshots

Clicking town image Clicking custom layer image

silverwolfg11 commented 1 year ago

Looking at the current code, it seems like MapTowny doesn't pass in the z-index to the area marker for Dynmap, so that's probably why changing the z-indexes isn't working.

I think I know the fix for this, so it should be fixed when the next version comes out (which I'll update this issue when it does).

Thanks for letting me know!

silverwolfg11 commented 1 year ago

This should be fixed in the latest release v2.0.1, but let me know if it's not and I'll re-open this issue.

ipiepiepie commented 1 year ago

@silverwolfg11 I still have this bug. Maybe I'm doing something wrong?

My custom layer settings is:

layer-priority: 10
z-index: 5

And MapTowny layer settings is:

layer-priority: 4
z-index: 550

Everything seems to be in order, but on my map I'm still see this image

silverwolfg11 commented 1 year ago

@ipiepiepie Hi, sorry for such a delayed response. I created a test plugin and I tested this out. The test plugin has a command that will create a layer at a specific layer index and priority and draw a marker on that layer. Here's an image of the test plugin working (I used the same layer priorities as you) and I also attached the code in a gist. Ignore the annotations in the code, that's for a framework that resolves the commands.

image

https://gist.github.com/silverwolfg11/f16efd2d36f1bebb482e81c6cb06804e

So what I found is that I think this may actually be a dynmap issue. The reason I say that is that when I first ran my test plugin, the priorities functioned as expected. However, when MapTowny re-renders all the towns (which is does regularly based on the configured interval), the MapTowny tooltip showed up above my test layer. However, when I refreshed the page, the test layer tooltip showed up as expected. So I think it's an ordering issue on dynmap side, maybe something with the client receiving the newest markers and overwriting the tooltip, I'm not sure.

I may be wrong though, so if you explored this issue further and got different results, please let me know!

ipiepiepie commented 1 year ago

@silverwolfg11 I also think it's a bug of dynmap. I tested this too, and saw the same result as you, but in my case layer priorities worked only after rendering town by /maptowny render [Town] or by re-render scheduler, but broken after refreshing the dynmap page.

I found out, that you can see layer heights (Z-index) in Surface mode and it everytime displays as expected, town's layer is upper, than my custom layer, but click priorities in Flat mode still broken. image

The strangest thing happend today, when I'm wanted to record it and write issue to Dynmap repo. Dynmap thought, that I'm clicking my custom layer always, even when I'm re-rendering layers, it doesn't worked at all. You can see my record of this bug here