Card in tooltip
Этот коммит содержится в:
родитель
ad33923c37
Коммит
ada1af0a8e
@ -6,8 +6,8 @@
|
|||||||
export let opacity;
|
export let opacity;
|
||||||
export let stroke;
|
export let stroke;
|
||||||
export let strokeWidth;
|
export let strokeWidth;
|
||||||
export let ttContent;
|
export let caseData;
|
||||||
export let tooltipContent;
|
export let hoveredCaseData;
|
||||||
export let tooltipX;
|
export let tooltipX;
|
||||||
export let tooltipY;
|
export let tooltipY;
|
||||||
export let showTooltip;
|
export let showTooltip;
|
||||||
@ -16,7 +16,8 @@
|
|||||||
showTooltip = true;
|
showTooltip = true;
|
||||||
tooltipX = event.clientX;
|
tooltipX = event.clientX;
|
||||||
tooltipY = event.clientY;
|
tooltipY = event.clientY;
|
||||||
tooltipContent = ttContent;
|
//tooltipContent = ttContent;
|
||||||
|
hoveredCaseData = caseData;
|
||||||
}
|
}
|
||||||
function handleMouseOut() {
|
function handleMouseOut() {
|
||||||
showTooltip = false;
|
showTooltip = false;
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<div class="modal-background" on:click={closeModal}></div>
|
<div class="modal-background" on:click={closeModal}></div>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
{#if activeCaseData}
|
{#if activeCaseData}
|
||||||
<CaseCard cardData={activeCaseData} expanded={true} ></CaseCard>
|
<CaseCard cardData={activeCaseData} expanded={true} ></CaseCard>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-close" on:click={closeModal}></div>
|
<div class="modal-close" on:click={closeModal}></div>
|
||||||
|
|||||||
@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
// Tooltip
|
// Tooltip
|
||||||
let showTooltip = false;
|
let showTooltip = false;
|
||||||
let tooltipContent;
|
let hoveredCaseData;
|
||||||
let tooltipX;
|
let tooltipX;
|
||||||
let tooltipY;
|
let tooltipY;
|
||||||
</script>
|
</script>
|
||||||
@ -132,9 +132,9 @@
|
|||||||
fill={actorNations.includes(attrCase.actor_nation[0]) ? colorScale(attrCase.actor_nation[0]) : colorScale('Other')}
|
fill={actorNations.includes(attrCase.actor_nation[0]) ? colorScale(attrCase.actor_nation[0]) : colorScale('Other')}
|
||||||
stroke={'#ffffff'}
|
stroke={'#ffffff'}
|
||||||
strokeWidth={1.5}
|
strokeWidth={1.5}
|
||||||
ttContent={`<p class="countryname">${attrCase.short_title}</p>`}
|
|
||||||
opacity={opacityScale(attrCase.attribution_score)}
|
opacity={opacityScale(attrCase.attribution_score)}
|
||||||
bind:tooltipContent
|
caseData={attrCase}
|
||||||
|
bind:hoveredCaseData
|
||||||
bind:tooltipX
|
bind:tooltipX
|
||||||
bind:tooltipY
|
bind:tooltipY
|
||||||
bind:showTooltip
|
bind:showTooltip
|
||||||
@ -212,7 +212,7 @@
|
|||||||
{/each}
|
{/each}
|
||||||
{#if xScale}
|
{#if xScale}
|
||||||
{#each events as event}
|
{#each events as event}
|
||||||
<Square
|
<!--Square
|
||||||
x={xScale(event.date)}
|
x={xScale(event.date)}
|
||||||
y={32}
|
y={32}
|
||||||
width={12}
|
width={12}
|
||||||
@ -225,14 +225,14 @@
|
|||||||
bind:tooltipX
|
bind:tooltipX
|
||||||
bind:tooltipY
|
bind:tooltipY
|
||||||
bind:showTooltip
|
bind:showTooltip
|
||||||
></Square>
|
></Square-->
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</g>
|
</g>
|
||||||
{/if}
|
{/if}
|
||||||
</svg>
|
</svg>
|
||||||
{#if showTooltip}
|
{#if showTooltip}
|
||||||
<Tooltip {tooltipX} {tooltipY} {tooltipContent} {width}/>
|
<Tooltip {tooltipX} {tooltipY} {hoveredCaseData} {width}/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
|
import CaseCard from '$lib/components/CaseCard.svelte';
|
||||||
|
|
||||||
export let tooltipX;
|
export let tooltipX;
|
||||||
export let tooltipY;
|
export let tooltipY;
|
||||||
export let tooltipContent;
|
export let hoveredCaseData;
|
||||||
export let width;
|
export let width;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -15,7 +17,7 @@
|
|||||||
left:{tooltipX < width - 300 ? tooltipX + 10 : tooltipX - 300 - 10}px;
|
left:{tooltipX < width - 300 ? tooltipX + 10 : tooltipX - 300 - 10}px;
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{@html tooltipContent}
|
<CaseCard cardData={hoveredCaseData} expanded={true}></CaseCard>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -28,7 +30,7 @@
|
|||||||
padding: 5px;
|
padding: 5px;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
|
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
|
||||||
width: 300px;
|
max-width: 500px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
Загрузка…
x
Ссылка в новой задаче
Block a user