Skip to content

Commit

Permalink
Don't use useless sphere clip-path when projection doesn't come from d3
Browse files Browse the repository at this point in the history
Should fix the wrong display when opening the resulting svg
in illustrator.
  • Loading branch information
mthh committed Oct 4, 2024
1 parent 17e87ea commit 3fc5db0
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import d3 from '../../helpers/d3-custom';

// Stores
import { globalStore } from '../../store/GlobalStore';
import { mapStore } from '../../store/MapStore';

// Directives
import bindData from '../../directives/bind-data';
Expand Down Expand Up @@ -58,7 +59,7 @@ export function categoricalChoroplethPolygonRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
shape-rendering={
(layerDescription.strokeWidth === 0 || layerDescription.strokeOpacity === 0)
Expand Down Expand Up @@ -112,7 +113,7 @@ export function categoricalChoroplethPointRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
// clip-path="url(#clip-sphere)"
// clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
mgt:geometry-type={layerDescription.type}
mgt:portrayal-type={layerDescription.representationType}
Expand Down Expand Up @@ -168,7 +169,7 @@ export function categoricalChoroplethLineRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
mgt:geometry-type={layerDescription.type}
mgt:portrayal-type={layerDescription.representationType}
Expand Down
7 changes: 4 additions & 3 deletions src/components/MapRenderer/ChoroplethMapRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import d3 from '../../helpers/d3-custom';

// Stores
import { globalStore } from '../../store/GlobalStore';
import { mapStore } from '../../store/MapStore';

// Directives
import bindData from '../../directives/bind-data';
Expand Down Expand Up @@ -53,7 +54,7 @@ export function choroplethPolygonRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
shape-rendering={
(layerDescription.strokeWidth === 0 || layerDescription.strokeOpacity === 0)
Expand Down Expand Up @@ -105,7 +106,7 @@ export function choroplethPointRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
// clip-path="url(#clip-sphere)"
// clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
mgt:geometry-type={layerDescription.type}
mgt:portrayal-type={layerDescription.representationType}
Expand Down Expand Up @@ -159,7 +160,7 @@ export function choroplethLineRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
mgt:geometry-type={layerDescription.type}
mgt:portrayal-type={layerDescription.representationType}
Expand Down
9 changes: 5 additions & 4 deletions src/components/MapRenderer/DefaultMapRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import d3 from '../../helpers/d3-custom';

// Stores
import { globalStore } from '../../store/GlobalStore';
import { mapStore } from '../../store/MapStore';

// Directives
import bindData from '../../directives/bind-data';
Expand Down Expand Up @@ -38,7 +39,7 @@ export function defaultPolygonRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
shape-rendering={
(layerDescription.strokeWidth === 0 || layerDescription.strokeOpacity === 0)
Expand Down Expand Up @@ -80,7 +81,7 @@ export function defaultPolygonRendererMeshed(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
shape-rendering={layerDescription.shapeRendering}
mgt:geometry-type={layerDescription.type}
Expand Down Expand Up @@ -116,7 +117,7 @@ export function defaultPointRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
// clip-path="url(#clip-sphere)"
// clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
mgt:geometry-type={layerDescription.type}
mgt:portrayal-type={layerDescription.representationType}
Expand Down Expand Up @@ -155,7 +156,7 @@ export function defaultLineRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
mgt:geometry-type={layerDescription.type}
mgt:portrayal-type={layerDescription.representationType}
Expand Down
3 changes: 2 additions & 1 deletion src/components/MapRenderer/DiscontinuityMapRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { getClassifier } from '../../helpers/classification';

// Stores
import { globalStore } from '../../store/GlobalStore';
import { mapStore } from '../../store/MapStore';

// Directives
import bindData from '../../directives/bind-data';
Expand Down Expand Up @@ -48,7 +49,7 @@ export default function discontinuityRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
mgt:geometry-type={layerDescription.type}
mgt:portrayal-type={layerDescription.representationType}
Expand Down
3 changes: 2 additions & 1 deletion src/components/MapRenderer/GraticuleRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { For, JSX } from 'solid-js';

// Stores
import { globalStore } from '../../store/GlobalStore';
import { mapStore } from '../../store/MapStore';

// Helpers
import { mergeFilterIds } from './common.tsx';
Expand Down Expand Up @@ -30,7 +31,7 @@ export default function graticuleRenderer(layerDescription: LayerDescription): J
stroke-linecap="round"
stroke-linejoin="round"
stroke-dasharray={layerDescription.strokeDasharray}
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
mgt:geometry-type={layerDescription.type}
mgt:portrayal-type={layerDescription.representationType}
Expand Down
3 changes: 2 additions & 1 deletion src/components/MapRenderer/GridRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { mergeFilterIds } from './common.tsx';

// Stores
import { globalStore } from '../../store/GlobalStore';
import { mapStore } from '../../store/MapStore';

// Directives
import bindData from '../../directives/bind-data';
Expand Down Expand Up @@ -50,7 +51,7 @@ export default function gridRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
shape-rendering={
(layerDescription.strokeWidth === 0 || layerDescription.strokeOpacity === 0)
Expand Down
5 changes: 3 additions & 2 deletions src/components/MapRenderer/LinksMapRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import applyFilters from '../../helpers/filtering';

// Stores
import { globalStore } from '../../store/GlobalStore';
import { mapStore } from '../../store/MapStore';

// Directives
import bindData from '../../directives/bind-data';
Expand Down Expand Up @@ -59,7 +60,7 @@ export default function linksRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
mgt:geometry-type={layerDescription.type}
mgt:portrayal-type={layerDescription.representationType}
Expand Down Expand Up @@ -112,7 +113,7 @@ export default function linksRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
mgt:geometry-type={layerDescription.type}
mgt:portrayal-type={layerDescription.representationType}
Expand Down
3 changes: 2 additions & 1 deletion src/components/MapRenderer/SmoothedMapRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { mergeFilterIds } from './common.tsx';

// Stores
import { globalStore } from '../../store/GlobalStore';
import { mapStore } from '../../store/MapStore';

// Directives
import bindData from '../../directives/bind-data';
Expand Down Expand Up @@ -50,7 +51,7 @@ export default function smoothedMapRenderer(
stroke-opacity={layerDescription.strokeOpacity}
stroke-linecap="round"
stroke-linejoin="round"
clip-path="url(#clip-sphere)"
clip-path={mapStore.projection.type === 'd3' ? 'url(#clip-sphere)' : undefined}
filter={mergeFilterIds(layerDescription)}
shape-rendering={
(layerDescription.strokeWidth === 0 || layerDescription.strokeOpacity === 0)
Expand Down

0 comments on commit 3fc5db0

Please sign in to comment.