cirrahn / foundry-polmap

A political map overlay module for Foundry VTT.
MIT License
2 stars 1 forks source link

Layers Appearing In Front Of Tokens #8

Open tetra8 opened 1 year ago

tetra8 commented 1 year ago

On the latest version, it looks as though layers will always appear in front of tokens, no matter how the z-index option is changed.

cirrahn commented 1 year ago

Some initial investigations:

The token layer (canvas.tokens) is just an "interaction" layer. It has the following structure:

The token iamge meshes are instead children of canvas.primary container, which is a grab-bag of visual elements, sorted according to "elevation." In V11, there's an additional constraint, defined by a PRIMARY_SORT_ORDER variable per layer (DrawingShape at 500, TokenMesh at 750, and WeatherEffects at 1000), which prevents e.g. a weather effect with no elevation defined from rendering below a token mesh.

To allow a user to move the polmap layer above/or below token images, we would need to split the current layer into an "interaction" part and an "overlay" part, and add the "overlay" part to the primary canvas group. A second z-index-like config option would then be added, to allow the user to set an "elevation" for the overlay. The user would then be free to set this to e.g. -999 if they wanted the overlay to always appear below their tokens.

bennyty commented 1 year ago

Excited this is fixed, Unfortunately I think this is tied into the v11 compatibility release. The LANCER community uses your excellent module to mark areas as terrain/control points etc but the LANCER is stuck on v10. Is there any way to back-port this to v10?

cirrahn commented 1 year ago

Sorry, this is not fixed even in v11. It looks like GitHub mis-interpreted my commit message!

I don't remember if I was able to properly reproduce the bug anyway. If you have a scene which is a good example of the undesirable behaviour, please export it and post the result here (with a note or screenshot of the module config too).

tetra8 commented 1 year ago

I can do that. Would you be ok if the scene was in V10?

cirrahn commented 1 year ago

Sure!

tetra8 commented 1 year ago

Ok, this is a scene with the latest versions of Foundry v10 (303), the Lancer system (1.6.1), and the module (2.0.1). I've not modified the default module settings in any way. What you should see is that the token in the scene is visually underneath the overlay, and remains so no matter how the z-index option is changed.