Dropped object icons don't appear when placing objects in 2D map mode (pitch = 0, top-down view).
Isometric (3D) Mode:
- Uses different sprite images for each 45° rotation (e.g.,
bench_000,bench_045, etc.) - Swaps sprite images as camera/object rotates
- CSS rotation is 0
Top-Down (2D) Mode:
- Always uses angle
0sprite (e.g.,bench_000) - Uses CSS
icon-rotateproperty to rotate the sprite visually - More performant as it doesn't require sprite swapping
- Objects are placed or view changes to 2D
useEffectinDroppedObjects.jsx(lines 197-248) preloads spritesaddEnhancedSpritesToMapis called with:baseName: e.g., "bench"viewType: "top-down"urlBuilder:buildFlatSpriteUrl
- URL is constructed:
/static/bench/bench_TOP_000.png - Image loads and is registered with ID:
bench_000 rebuildDroppedDatais called to update feature properties- Features with ready sprites get
icon_imageproperty set - Symbol layer displays features that have
icon_image
✅ Sprite files exist in /public/static/{object}/
- Example:
/public/static/bench/bench_TOP_000.pngthroughbench_TOP_315.png - All 8 angles present for both isometric and top-down views
In DroppedObjects.jsx:
- Logs when sprite preload effect runs
- Logs each object being processed
- Logs sprite loading attempts
- Logs when
rebuildDroppedDatais called - Logs when icons are ready vs not ready
In enhancedRenderingUtils.js:
- Logs sprite loading attempts with URLs
- Logs successful loads with source URL
- Logs failed loads with error details
- Logs when sprites are already cached
Open browser console and run:
window.__DEBUG_DROPPED_OBJECTS__ = trueThen refresh and try placing objects in 2D mode.
-
Sprite Loading:
[DroppedObjects] preload sprites effect { viewType: 'top-down', objectCount: 1 } [DroppedObjects] will load sprite { base: 'bench', angle: 0, viewType: 'top-down' } [addEnhancedSprites] loading { id: 'bench_000', urls: ['/static/bench/bench_TOP_000.png', ...] } -
Successful Load:
[addEnhancedSprites] loaded successfully { id: 'bench_000', src: '/static/bench/bench_TOP_000.png' } [DroppedObjects] sprites loaded, incrementing nonce -
Icon Ready Check:
[DroppedObjects] rebuildDroppedData called { viewType: 'top-down', bearing: 0, objectCount: 1 } [DroppedObjects] icon ready { objId: 'xxx', imgId: 'bench_000', iconRotate: 45 } -
Icon NOT Ready (Problem):
[DroppedObjects] icon NOT ready { objId: 'xxx', imgId: 'bench_000', hasPrevIcon: false }
-
Race Condition: Features are rebuilt before sprites finish loading
- Solution: Sprites should trigger rebuild via
spritesReadyNonce(line 491)
- Solution: Sprites should trigger rebuild via
-
URL Construction: Wrong URL being generated for 2D sprites
- Check:
buildFlatSpriteUrl('bench', 0, 'top-down')should return/static/bench/bench_TOP_000.png
- Check:
-
Image Registration: Sprites load but aren't registered with map
- Check:
map.hasImage('bench_000')should return true after load
- Check:
-
Layer Visibility: Features have
icon_imagebut layer doesn't show them- Check:
DROPPED_SYMBOL_LAYER_IDlayer exists and is visible - Check: Features have
icon_imageproperty in source data
- Check:
- Open app in 2D mode (pitch = 0)
- Enable debug logging
- Select a placeable object (e.g., bench, chair)
- Click on map to place object
- Observe console logs
- Check if icon appears on map
Expected:
- Sprite loads from
/static/{object}/{object}_TOP_000.png - Sprite registered as
{object}_000 - Feature gets
icon_imageproperty - Icon appears on map with CSS rotation
Actual (if broken):
- Need to observe console logs to determine exact failure point
-
DroppedObjects.jsx:
- Line 13: Enabled DEBUG flag
- Lines 202-224: Added detailed logging to sprite preload effect
- Line 258: Added logging to
rebuildDroppedData - Lines 305, 309: Added icon ready/not ready logging
-
enhancedRenderingUtils.js:
- Lines 146-147: Added function entry logging
- Lines 157, 174, 179, 197, 202: Added sprite loading lifecycle logs
- Run the app with debug logging enabled
- Place objects in 2D mode
- Analyze console logs to identify exact failure point
- Apply targeted fix based on findings
- Test with different object types
- Verify rotation works correctly
- Test view switching (2D ↔ 3D) to ensure sprites update properly
If debug logging needs to be disabled:
- Set
DEBUG = falseinDroppedObjects.jsxline 13 - Remove or comment out the debug logging additions in both files