Skip to content

Commit 7b52b2e

Browse files
committed
Fix - VueUiWorld - Apply patterns
1 parent 37eef36 commit 7b52b2e

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

TestingArena/ArenaVueUiWorld.vue

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,29 @@ const model = ref([
238238
{ key: 'style.chart.tooltip.showMinimap', def: true, type: 'checkbox'},
239239
]);
240240
241+
const projections = ref([
242+
'aitoff',
243+
'azimuthalEquidistant',
244+
'bonne',
245+
'equirectangular',
246+
'gallPeters',
247+
'globe',
248+
'hammer',
249+
'mercator',
250+
'mollweide',
251+
'robinson',
252+
'sinusoidal',
253+
'vanDerGrinten',
254+
'winkelTripel'
255+
])
256+
257+
const currentProjection = ref('globe')
258+
241259
const config = computed(() => {
242260
const c = convertArrayToObject(model.value);
243261
return {
244262
...c,
263+
projection: currentProjection.value,
245264
style: {
246265
...c.style,
247266
chart: {
@@ -260,11 +279,23 @@ const config = computed(() => {
260279
</script>
261280

262281
<template>
282+
<select v-model="currentProjection">
283+
<option v-for="p in projections">{{ p }}</option>
284+
</select>
263285
<Box>
264286
<template #title>VueUiWorld</template>
265287

266288
<template #local>
267-
<LocalVueUiWorld :dataset="dataset" :config="config"/>
289+
<LocalVueUiWorld :dataset="dataset" :config="config">
290+
<template #pattern="{ datapoint, patternId }">
291+
<pattern :id="patternId" width="70" height="8" patternTransform="scale(2)"
292+
patternUnits="userSpaceOnUse" opacity="0.5">
293+
<rect width="100%" height="100%" fill="#FFFFFF20" />
294+
<path fill="none" stroke="#ecc94b"
295+
d="M-.02 22c8.373 0 11.938-4.695 16.32-9.662C20.785 7.258 25.728 2 35 2s14.215 5.258 18.7 10.338C58.082 17.305 61.647 22 70.02 22M-.02 14.002C8.353 14 11.918 9.306 16.3 4.339 20.785-.742 25.728-6 35-6S49.215-.742 53.7 4.339c4.382 4.967 7.947 9.661 16.32 9.664M70 6.004c-8.373-.001-11.918-4.698-16.3-9.665C49.215-8.742 44.272-14 35-14S20.785-8.742 16.3-3.661C11.918 1.306 8.353 6-.02 6.002" />
296+
</pattern>
297+
</template>
298+
</LocalVueUiWorld>
268299
</template>
269300

270301
<template #VDUI-local>

src/components/vue-ui-world.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,15 @@ defineExpose({
792792
</template>
793793
</title>
794794
</path>
795+
<path
796+
v-if="$slots.pattern"
797+
:d="country.path"
798+
:fill="`url(#pattern_${uid}_${country.code})`"
799+
:stroke="FINAL_CONFIG.style.chart.territory.stroke"
800+
:stroke-width="FINAL_CONFIG.style.chart.territory.strokeWidthSelected"
801+
style="pointer-events: none;"
802+
class="vue-ui-world-territory"
803+
/>
795804
<path
796805
v-if="selectedDatapoint"
797806
:d="geoToPath(selectedDatapoint.geometry)"

0 commit comments

Comments
 (0)