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] Selection box allows players to reveal fog of war #120

Open LudovicBrillon opened 1 month ago

LudovicBrillon commented 1 month ago

Setup

Describe the bug The setup: I have a hexagonal map crawl setup, with a single token controlled by the group. I use a drawing for a bounding box to lock the view, attached with the module token attacher to the group token. Fog exploration is turned on.

The bug: Whenever a player drags his mouse to form a selection box, and he slides the box to the side of his screen, the camera will shift toward where the mouse is trying to go off screen, which is normal behaviour. However, the vision of the token follows the camera, without moving the token, and reveals the fog of war around it. The weird thing is that when the player lets go of the selection, the fog goes back to it's unexplored state, despite fog exploration being turned on.

The camera stays within the bounding box during this whole thing, but the ability to discover fog of war that easily (and most of all by accident), is something I believe should be looked at. This only affects the player exploiting the bug, but the harm is done if even by accident they trigger it, which is very likely.

Screenshots

Initial view: 1

Player forms a selection box: 2

The mouse is brought to the top of the screen, the camera follows (but stays in the bounding box) and with it the token vision: 3

The player lets go of the selection box and drags his camera a tiny bit to update the screen, all returns to normal: 4

Console Log

I do not know if this has something to do with the bug, this error shows up inconsistently, seemingly at random. It even shows up when on other maps that don't have any lock view shenanigans in place.

viewbox.js:150 Uncaught (in promise) TypeError: undefined. Cannot read properties of undefined (reading 'control') [Detected 1 package: LockView(1.5.10)] 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 drawViewbox @ viewbox.js:150 (anonymous) @ socket.js:18 U.emit @ index.mjs:136 value @ socket.js:538 value @ socket.js:525 value @ socket.js:495 U.emit @ index.mjs:136 (anonymous) @ manager.js:204 Promise.then ce @ websocket-constructor.browser.js:5 value @ manager.js:203 U.emit @ index.mjs:136 value @ index.js:146 value @ manager.js:190 U.emit @ index.mjs:136 value @ socket.js:341 U.emit @ index.mjs:136 value @ transport.js:98 value @ transport.js:90 ws.onmessage @ websocket.js:68 Show 11 more frames Show less

Additional context Nothing I can think of.