Javiondox / html-to-scene

A FoundryVTT module that allows embedding HTML files on scenes.
MIT License
6 stars 4 forks source link

restoreui overwrites assumed defaults #9

Open kylepulver opened 2 years ago

kylepulver commented 2 years ago

really like this module but it clashes with modifications/customizations of the ui classes it applies css to.

maybe it could work to get the actual unmodified ui data by using something like

$("#ui-top").css(["display","margin-left"])

to get the display, and margin-left. then when restoring, you're not relying on the strict foundry defaults hard coded, but the data sampled at the initialization.

(for example, my ui-top is display block, margin left 0px, so when restoreUI is called, my changes get reverted)

Javiondox commented 2 years ago

Yeah, I haven't touched that from the start, and in the comments it was already mentioned that in some themes that would case issues. When you are able, tell me the modification that you use, and I will try to make it compatible. Meanwhile, I will try to get the actual values instead of hard-coding them back.

Javiondox commented 2 years ago

If you are able, test the 1.2.4 update with your customizations.

kylepulver commented 2 years ago

1.2.4 has the same behavior for me. the ui-top is given the styles of display inline-block and margin-left -90px by the restoreUi method, overwriting any prior modifications. my css that affects ui-top is just:

#ui-top {
    margin: 0;
}

#ui-top.offset {
    margin-left: 0;
}

my modifications are made by a custom system that only my play groups use, so don't worry about supporting it specifically. i can also tinker with it on my end and submit a pull request if you're open to it.

Javiondox commented 2 years ago

Try with the current build. And yes, I am open to pull requests. There are some bugs with the current implementation (mainly the foundry logo appearing back in some themes / minimal ui), but I am not setting neither display: x nor touching the margins of objects.

(I am doing visibility:hidden right now. The components are hidden from view, can't be interacted, but their space is respected in the layout. Right now, the only exceptions are: Foundry's board (the canvas) (just because it's a layer underneath everything) and SmallTime's clock (because it is a floating window))

kylepulver commented 2 years ago

my mistake -- i was looking at this line which was changed in v1.2.5 https://github.com/Javiondox/html-to-scene/commit/2bd313297775b02a2b8dc4c73355243330dabe39#diff-f0f8a48c1b729cef6410b7675dfdae2a8320c6e708ffd517b41f9ae2d27c3175L263

currently version 1.2.5 does not seem to function with the following error in my console image

Javiondox commented 2 years ago

Sorry for the late reply, I just released v1.3.0 and while I didn't modify the normal inner workings of that function (by a lot), since v1.2.6 the style execution was delayed after renderSceneControls to avoid similar issues (I didn't change any code of that function v1.2.5 for what it looks). Try to look if it still happens and if that is the case I will add a check to look for the visibility. If the error persists, please include another photo, as the codebase has changed a bit.

kylepulver commented 2 years ago

hey sorry i left this hanging for so long. life took me away from foundry stuff for the last little bit.

anyway, here are the errors trying to use v1.3.0 image image