@@ -320,16 +320,15 @@ function clipDefs({ownerSVGElement}) {
320320}
321321
322322// Note: may mutate selection.node!
323- const frame = Symbol ( "frame" ) ;
324323function applyClip ( selection , mark , dimensions , context ) {
325324 let clipUrl ;
326325 switch ( mark . clip ) {
327326 case "frame" : {
328- const clips = context . clips ?? ( context . clips = new WeakMap ( ) ) ;
329- if ( ! clips . has ( frame ) ) {
327+ const clips = context . clips ?? ( context . clips = new Map ( ) ) ;
328+ if ( ! clips . has ( " frame" ) ) {
330329 const { width, height, marginLeft, marginRight, marginTop, marginBottom} = dimensions ;
331330 const id = getClipId ( ) ;
332- clips . set ( frame , id ) ;
331+ clips . set ( " frame" , id ) ;
333332 clipDefs ( context )
334333 . append ( "clipPath" )
335334 . attr ( "id" , id )
@@ -343,23 +342,23 @@ function applyClip(selection, mark, dimensions, context) {
343342 this . appendChild ( selection . node ( ) ) ;
344343 selection . node = ( ) => this ; // Note: mutation!
345344 } ) ;
346- clipUrl = `url(#${ clips . get ( frame ) } )` ;
345+ clipUrl = `url(#${ clips . get ( " frame" ) } )` ;
347346 break ;
348347 }
349348 case "sphere" : {
350- const clips = context . clips ?? ( context . clips = new WeakMap ( ) ) ;
349+ const clips = context . clips ?? ( context . clips = new Map ( ) ) ;
351350 const { projection} = context ;
352351 if ( ! projection ) throw new Error ( `the "sphere" clip option requires a projection` ) ;
353- if ( ! clips . has ( projection ) ) {
352+ if ( ! clips . has ( " projection" ) ) {
354353 const id = getClipId ( ) ;
355- clips . set ( projection , id ) ;
354+ clips . set ( " projection" , id ) ;
356355 clipDefs ( context )
357356 . append ( "clipPath" )
358357 . attr ( "id" , id )
359358 . append ( "path" )
360359 . attr ( "d" , geoPath ( projection ) ( { type : "Sphere" } ) ) ;
361360 }
362- clipUrl = `url(#${ clips . get ( projection ) } )` ;
361+ clipUrl = `url(#${ clips . get ( " projection" ) } )` ;
363362 break ;
364363 }
365364 }
0 commit comments