|
1 | 1 | import React from 'react';
|
2 | 2 | import { geoPath, geoMercator } from 'd3-geo';
|
3 |
| -import { toCircle, fromCircle } from 'flubber'; |
| 3 | +import { toCircle, fromCircle, combine } from 'flubber'; |
4 | 4 | import { interpolateHsl, interpolateNumber } from 'd3-interpolate';
|
5 | 5 | import { scaleLinear } from 'd3-scale';
|
6 | 6 | import TweenMax from 'gsap/TweenMax';
|
@@ -103,6 +103,12 @@ class VisualizationLayer extends React.Component {
|
103 | 103 | .filter(d => d.length > 0)
|
104 | 104 | .sort((a, b) => b.length - a.length)
|
105 | 105 | .join('M')}`;
|
| 106 | + |
| 107 | + d.geoPathMultiple = d.geoPath.split('M').filter((d, i) => i !== 0); |
| 108 | + d.geoPathMultiple = d.geoPathMultiple.map(gp => `M${gp}`); |
| 109 | + console.log('d.geoPathMultiple', d.geoPathMultiple); |
| 110 | + console.log('d.circlePath', d.circlePath); |
| 111 | + console.log('d.geoPath', d.geoPath); |
106 | 112 | }
|
107 | 113 |
|
108 | 114 | d.properties.neighbors &&
|
@@ -204,7 +210,9 @@ class VisualizationLayer extends React.Component {
|
204 | 210 | }
|
205 | 211 |
|
206 | 212 | d.circlePath = generateCirclePath(d.x, d.y, d.r);
|
207 |
| - d.toCartogram = toCircle(d.geoPath, d.x, d.y, d.r); |
| 213 | + d.toCartogram = d.geoPathMultiple |
| 214 | + ? combine(d.geoPathMultiple, d.circlePath) |
| 215 | + : toCircle(d.geoPath, d.x, d.y, d.r); |
208 | 216 | d.toMap = fromCircle(d.x, d.y, d.r, d.geoPath);
|
209 | 217 | d.toCartogramStyle = interpolateStyles(geoStyleD, circleStyleD);
|
210 | 218 | d.toMapStyle = interpolateStyles(circleStyleD, geoStyleD);
|
|
0 commit comments