@@ -313,17 +313,16 @@ function clipDefs({ownerSVGElement}) {
313
313
}
314
314
315
315
// Note: may mutate selection.node!
316
- const frame = Symbol ( "frame" ) ;
317
316
function applyClip ( selection , mark , dimensions , context ) {
318
317
let clipUrl ;
319
318
const { clip = context . clip } = mark ;
320
319
switch ( clip ) {
321
320
case "frame" : {
322
- const clips = context . clips ?? ( context . clips = new WeakMap ( ) ) ;
323
- if ( ! clips . has ( frame ) ) {
321
+ const clips = context . clips ?? ( context . clips = new Map ( ) ) ;
322
+ if ( ! clips . has ( " frame" ) ) {
324
323
const { width, height, marginLeft, marginRight, marginTop, marginBottom} = dimensions ;
325
324
const id = getClipId ( ) ;
326
- clips . set ( frame , id ) ;
325
+ clips . set ( " frame" , id ) ;
327
326
clipDefs ( context )
328
327
. append ( "clipPath" )
329
328
. attr ( "id" , id )
@@ -337,23 +336,23 @@ function applyClip(selection, mark, dimensions, context) {
337
336
this . appendChild ( selection . node ( ) ) ;
338
337
selection . node = ( ) => this ; // Note: mutation!
339
338
} ) ;
340
- clipUrl = `url(#${ clips . get ( frame ) } )` ;
339
+ clipUrl = `url(#${ clips . get ( " frame" ) } )` ;
341
340
break ;
342
341
}
343
342
case "sphere" : {
344
- const clips = context . clips ?? ( context . clips = new WeakMap ( ) ) ;
343
+ const clips = context . clips ?? ( context . clips = new Map ( ) ) ;
345
344
const { projection} = context ;
346
345
if ( ! projection ) throw new Error ( `the "sphere" clip option requires a projection` ) ;
347
- if ( ! clips . has ( projection ) ) {
346
+ if ( ! clips . has ( " projection" ) ) {
348
347
const id = getClipId ( ) ;
349
- clips . set ( projection , id ) ;
348
+ clips . set ( " projection" , id ) ;
350
349
clipDefs ( context )
351
350
. append ( "clipPath" )
352
351
. attr ( "id" , id )
353
352
. append ( "path" )
354
353
. attr ( "d" , geoPath ( projection ) ( { type : "Sphere" } ) ) ;
355
354
}
356
- clipUrl = `url(#${ clips . get ( projection ) } )` ;
355
+ clipUrl = `url(#${ clips . get ( " projection" ) } )` ;
357
356
break ;
358
357
}
359
358
}
0 commit comments