Skip to content

Commit c6476a0

Browse files
author
Gus
committed
v5.6.0
1 parent 44470eb commit c6476a0

22 files changed

Lines changed: 544 additions & 34 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Pin sprite deletion — use setTimeout defer + placeables.find
3+
description: How to reliably clean up pin sprites when a drawing is deleted
4+
type: feedback
5+
---
6+
7+
Use `setTimeout(0)` to defer `updatePins()` in the `deleteDrawing` hook. The hook fires mid-way through Foundry's deletion processing; deferring one event loop tick ensures the canvas layer has fully removed the placeable from `canvas.drawings.placeables` before rebuilding pins.
8+
9+
Also use `canvas.drawings.placeables.find(p => p.document.id === drawing.id)` instead of `canvas.drawings.get(drawing.id)` — the latter is unreliable in v14 when the placeable is being torn down.
10+
11+
**Why:** Pin sprites live in `pinsContainer` outside the drawing's own PIXI hierarchy. When a drawing is deleted, `updatePins()` called synchronously in the hook may still see the placeable in the collection and re-add the orphaned pin. Deferring solves this regardless of timing. `canvas.drawings.get()` was returning null even when the placeable was still accessible via `placeables.find()`.
12+
13+
**How to apply:** Any time you need to react to a drawing deletion and call `updatePins()`, wrap it in `setTimeout(() => { updatePins(); }, 0)`.

assets/stamps/classified.webp

23.3 KB
Loading

assets/stamps/deceased.webp

18 KB
Loading

assets/stamps/evidence.webp

18.5 KB
Loading

assets/stamps/missing.webp

14.9 KB
Loading

assets/stamps/redacted.webp

15.5 KB
Loading

assets/stamps/x-mark.webp

9.62 KB
Loading

module.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "investigation-board",
33
"title": "Investigation Board",
44
"description": "<p>A Foundry VTT module that lets everyone create, edit, and move sticky and photo notes on the scene as collaborative investigation tools.</p>",
5-
"version": "5.0.1",
5+
"version": "5.6.0",
66
"socket": true,
77
"authors": [
88
{

packs/ib-scenes/000045.ldb

2.48 KB
Binary file not shown.

packs/ib-scenes/CURRENT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MANIFEST-000042
1+
MANIFEST-000044

0 commit comments

Comments
 (0)