@@ -320,16 +320,15 @@ function clipDefs({ownerSVGElement}) {
320
320
}
321
321
322
322
// Note: may mutate selection.node!
323
- const frame = Symbol ( "frame" ) ;
324
323
function applyClip ( selection , mark , dimensions , context ) {
325
324
let clipUrl ;
326
325
switch ( mark . clip ) {
327
326
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" ) ) {
330
329
const { width, height, marginLeft, marginRight, marginTop, marginBottom} = dimensions ;
331
330
const id = getClipId ( ) ;
332
- clips . set ( frame , id ) ;
331
+ clips . set ( " frame" , id ) ;
333
332
clipDefs ( context )
334
333
. append ( "clipPath" )
335
334
. attr ( "id" , id )
@@ -343,23 +342,23 @@ function applyClip(selection, mark, dimensions, context) {
343
342
this . appendChild ( selection . node ( ) ) ;
344
343
selection . node = ( ) => this ; // Note: mutation!
345
344
} ) ;
346
- clipUrl = `url(#${ clips . get ( frame ) } )` ;
345
+ clipUrl = `url(#${ clips . get ( " frame" ) } )` ;
347
346
break ;
348
347
}
349
348
case "sphere" : {
350
- const clips = context . clips ?? ( context . clips = new WeakMap ( ) ) ;
349
+ const clips = context . clips ?? ( context . clips = new Map ( ) ) ;
351
350
const { projection} = context ;
352
351
if ( ! projection ) throw new Error ( `the "sphere" clip option requires a projection` ) ;
353
- if ( ! clips . has ( projection ) ) {
352
+ if ( ! clips . has ( " projection" ) ) {
354
353
const id = getClipId ( ) ;
355
- clips . set ( projection , id ) ;
354
+ clips . set ( " projection" , id ) ;
356
355
clipDefs ( context )
357
356
. append ( "clipPath" )
358
357
. attr ( "id" , id )
359
358
. append ( "path" )
360
359
. attr ( "d" , geoPath ( projection ) ( { type : "Sphere" } ) ) ;
361
360
}
362
- clipUrl = `url(#${ clips . get ( projection ) } )` ;
361
+ clipUrl = `url(#${ clips . get ( " projection" ) } )` ;
363
362
break ;
364
363
}
365
364
}
0 commit comments