@@ -8,38 +8,40 @@ export const FogOfWar = L.Layer.extend({
88 this . _canvas . style . position = "absolute" ;
99 this . _canvas . style . top = "0" ;
1010 this . _canvas . style . left = "0" ;
11+ this . _canvas . style . width = "100%" ;
12+ this . _canvas . style . height = "100%" ;
1113 this . _canvas . style . pointerEvents = "none" ;
12- this . _canvas . style . zIndex = "300 " ;
14+ this . _canvas . style . zIndex = "1000 " ;
1315
1416 const container = map . getContainer ( ) ;
1517 container . appendChild ( this . _canvas ) ;
1618
1719 this . _ctx = this . _canvas . getContext ( "2d" ) ;
1820
19- map . on ( "moveend resize zoomend" , this . _update , this ) ;
20- map . on ( "viewreset" , this . _update , this ) ;
21+ map . on ( "moveend resize zoomend zoom " , this . _update , this ) ;
22+ map . on ( "viewreset move " , this . _update , this ) ;
2123
2224 this . _update ( ) ;
2325 } ,
2426
2527 onRemove : function ( map ) {
2628 L . DomUtil . remove ( this . _canvas ) ;
27- map . off ( "moveend resize zoomend viewreset" , this . _update , this ) ;
29+ map . off ( "moveend resize zoomend zoom viewreset move " , this . _update , this ) ;
2830 } ,
2931
3032 _update : function ( ) {
31- if ( ! this . _map || ! S . playerList ) return ;
33+ if ( ! this . _map || ! this . _canvas || ! S . playerList ) return ;
3234
3335 const size = this . _map . getSize ( ) ;
36+
37+ // Set canvas resolution (internal size)
3438 this . _canvas . width = size . x ;
3539 this . _canvas . height = size . y ;
36- this . _canvas . style . width = size . x + "px" ;
37- this . _canvas . style . height = size . y + "px" ;
3840
3941 this . _ctx . clearRect ( 0 , 0 , this . _canvas . width , this . _canvas . height ) ;
4042
4143 // Fill entire canvas with fully black overlay
42- this . _ctx . fillStyle = "rgba (0, 0, 0, 1 )" ;
44+ this . _ctx . fillStyle = "rgb (0, 0, 0)" ;
4345 this . _ctx . fillRect ( 0 , 0 , this . _canvas . width , this . _canvas . height ) ;
4446
4547 // Clear circles around each player (flashlight effect)
0 commit comments