@@ -352,21 +352,20 @@ const getFrameClip = memoizeClip((clipPath, context, dimensions) => {
352352 . attr ( "height" , height - marginTop - marginBottom ) ;
353353} ) ;
354354
355- const getGeoClip = ( function ( ) {
356- const cache = new WeakMap ( ) ;
357- const sphere = { type : "Sphere" } ;
358- return ( geo , context ) => {
359- let c , url ;
360- if ( ! ( c = cache . get ( context ) ) ) cache . set ( context , ( c = new WeakMap ( ) ) ) ;
361- if ( geo . type === "Sphere" ) geo = sphere ; // coalesce all spheres.
362- if ( ! ( url = c . get ( geo ) ) ) {
363- const id = getClipId ( ) ;
364- select ( context . ownerSVGElement ) . append ( "clipPath" ) . attr ( "id" , id ) . append ( "path" ) . attr ( "d" , context . path ( ) ( geo ) ) ;
365- c . set ( geo , ( url = `url(#${ id } )` ) ) ;
366- }
367- return url ;
368- } ;
369- } ) ( ) ;
355+ const geoClipCache = new WeakMap ( ) ;
356+ const sphere = { type : "Sphere" } ;
357+
358+ function getGeoClip ( geo , context ) {
359+ let cache , url ;
360+ if ( ! ( cache = geoClipCache . get ( context ) ) ) geoClipCache . set ( context , ( cache = new WeakMap ( ) ) ) ;
361+ if ( geo . type === "Sphere" ) geo = sphere ; // coalesce all spheres
362+ if ( ! ( url = cache . get ( geo ) ) ) {
363+ const id = getClipId ( ) ;
364+ select ( context . ownerSVGElement ) . append ( "clipPath" ) . attr ( "id" , id ) . append ( "path" ) . attr ( "d" , context . path ( ) ( geo ) ) ;
365+ cache . set ( geo , ( url = `url(#${ id } )` ) ) ;
366+ }
367+ return url ;
368+ }
370369
371370// Note: may mutate selection.node!
372371export function applyIndirectStyles ( selection , mark , dimensions , context ) {
0 commit comments