MaterialFoundry / LockView

Foundry VTT module: Locks the view for the purpose of using Foundry on a digital playmat, such as a horizontally mounted TV. Scales the scene so the gridsize is always displayed corresponding to a real-world size, and can block zooming and panning
15 stars 7 forks source link

[BUG] Undefined setting causes breaking bug #118

Open KristjanLaane opened 3 months ago

KristjanLaane commented 3 months ago

Describe the bug I can enable LockView and change module settings, but none of the functionality actually works. And i see lots of Errors being thrown:

viewbox.js:150 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'control') at drawViewbox (viewbox.js:150:95) at a. (socket.js:18:46) at U.emit (index.mjs:136:20) at a.value (socket.js:538:20) at a.value (socket.js:525:18) at a.value (socket.js:495:22) at U.emit (index.mjs:136:20) at manager.js:204:18

Console Log image

I dont know if this error is related also:

foundry.js:631 Error: Error thrown in hooked function '' for hook 'getSceneControlButtons'. Cannot read properties of null (reading 'getFlag') at Hooks.onError (foundry.js:630:24) at 🎁call_wrapped [as call_wrapped] (libWrapper-wrapper.js:507:22) at 🎁Hooks.onError#lib-wrapper (listeners.js:138:11) at 🎁Hooks.onError#0 (libWrapper-wrapper.js:187:52) at #call (foundry.js:612:36) at Hooks.callAll (foundry.js:565:17) at SceneControls._getControlButtons (foundry.js:82176:11) at (foundry.js:81190:19) at new SceneControls (foundry.js:81172:1) at Game.initializeUI (foundry.js:9153:15) at Game.setupGame (foundry.js:9005:10) at async Game._initializeGameView (foundry.js:10354:5)

MaterialFoundry commented 3 months ago

The LibWrapper error could indicate a module incompatibility. Please try disabling all other modules and see if the issue persists. If it does not, you could try the 'Find The Culprit' module to figure out which module is causing the incompatibility.

KristjanLaane commented 3 months ago

thanks for the suggestion, i tried a world with no modules activated other than LockView, and get the same error.

this error occurs on world startup: image

and as soon as a player logs in this error follows: image

and no LockView functionality works even though the LockView UI is all there: image

KristjanLaane commented 3 months ago

i tried the same with libwrapper enabled, i dont know if that is a required dependency of LockView: image but regardless, the errors and the lack of functionality are exactly the same

MaterialFoundry commented 3 months ago

LibWrapper isn't used by Lock View.

Could you try the following: Go into the user config in the module settings, tick one of the boxes, save the settings, untick that box, and refresh.

KristjanLaane commented 3 months ago

i dont know what witchcraft this is, but it worked!

KristjanLaane commented 3 months ago

it makes the TypeError go away, but the initial hook error is still there, but Edit Viewbox for instance works still

MaterialFoundry commented 3 months ago

The problem is that it's looking for a setting that does not exist yet. When you tick one of the boxes this setting is generated.


Note to self:

I'm not sure about the hook error, nothing in the error message points (directly) to Lock View (they're all pointing to foundry.js, so the core Foundry code). It is possible that Lock View is responsible, but it's hard to find out where it goes wrong. What do you get when you expand the warning message (the yellow one above it)? If you scroll al the way up, are the no other errors? When Lock View is disabled, does the error go away?

MaterialFoundry commented 3 months ago

Actually, I might know where it might be going wrong, and I remember getting the same error but ignoring it because it didn't seem to do any harm.


Note to self:

KristjanLaane commented 3 months ago

Here is the expanded warning before hook error : image Yes it seems the scene gets initialized after the error: image When i disable LockView i get no error at all

also, thank you for an awesome addon, amazingly useful functionality!