Tooltips and attribution links
Этот коммит содержится в:
		
							родитель
							
								
									af9e2739ac
								
							
						
					
					
						Коммит
						636d0b9c38
					
				@ -19,6 +19,7 @@
 | 
				
			|||||||
	<div class="card-content">
 | 
						<div class="card-content">
 | 
				
			||||||
		<div class="content">
 | 
							<div class="content">
 | 
				
			||||||
			<p>{utcFormat('%B %d, %Y')(cardData.attribution_date)}</p>
 | 
								<p>{utcFormat('%B %d, %Y')(cardData.attribution_date)}</p>
 | 
				
			||||||
 | 
								<p><a href={cardData.attribution_url} target='_blank'>{cardData.source}</a></p>
 | 
				
			||||||
			<p>{cardData.short_description}</p>
 | 
								<p>{cardData.short_description}</p>
 | 
				
			||||||
			<p>
 | 
								<p>
 | 
				
			||||||
				<button class="button is-info is-small" on:click={sourceFilter.selectOne(cardData.source)}
 | 
									<button class="button is-info is-small" on:click={sourceFilter.selectOne(cardData.source)}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										41
									
								
								src/lib/components/Square.svelte
									
									
									
									
									
										Обычный файл
									
								
							
							
						
						
									
										41
									
								
								src/lib/components/Square.svelte
									
									
									
									
									
										Обычный файл
									
								
							@ -0,0 +1,41 @@
 | 
				
			|||||||
 | 
					<script>
 | 
				
			||||||
 | 
					  export let x;
 | 
				
			||||||
 | 
					  export let y;
 | 
				
			||||||
 | 
					  export let width;
 | 
				
			||||||
 | 
					  export let fill;
 | 
				
			||||||
 | 
					  export let opacity;
 | 
				
			||||||
 | 
					  export let ttContent;
 | 
				
			||||||
 | 
					  export let tooltipContent;
 | 
				
			||||||
 | 
					  export let tooltipX;
 | 
				
			||||||
 | 
					  export let tooltipY;
 | 
				
			||||||
 | 
					  export let showTooltip;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  function handleMouseOver(event) {
 | 
				
			||||||
 | 
					    showTooltip = true;
 | 
				
			||||||
 | 
					    tooltipX = event.clientX;
 | 
				
			||||||
 | 
					    tooltipY = event.clientY;
 | 
				
			||||||
 | 
					    tooltipContent = ttContent;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  function handleMouseOut() {
 | 
				
			||||||
 | 
					    showTooltip = false;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<rect
 | 
				
			||||||
 | 
					  x={x - width/2}
 | 
				
			||||||
 | 
					  y={y - width/2}
 | 
				
			||||||
 | 
					  {width}
 | 
				
			||||||
 | 
					  height={width}
 | 
				
			||||||
 | 
					  {fill}
 | 
				
			||||||
 | 
					  {opacity}
 | 
				
			||||||
 | 
					  on:mouseover={handleMouseOver}
 | 
				
			||||||
 | 
					  on:focus={handleMouseOver}
 | 
				
			||||||
 | 
					  on:mouseout={handleMouseOut}
 | 
				
			||||||
 | 
					  on:blur={handleMouseOut}
 | 
				
			||||||
 | 
					/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<style>
 | 
				
			||||||
 | 
					  rect {
 | 
				
			||||||
 | 
					    stroke: white;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
@ -4,6 +4,7 @@
 | 
				
			|||||||
	import { utcFormat } from 'd3-time-format';
 | 
						import { utcFormat } from 'd3-time-format';
 | 
				
			||||||
	import { fade } from 'svelte/transition';
 | 
						import { fade } from 'svelte/transition';
 | 
				
			||||||
	import Bubble from '$lib/components/Bubble.svelte';
 | 
						import Bubble from '$lib/components/Bubble.svelte';
 | 
				
			||||||
 | 
						import Square from '$lib/components/Square.svelte';
 | 
				
			||||||
	import Tooltip from '$lib/components/Tooltip.svelte';
 | 
						import Tooltip from '$lib/components/Tooltip.svelte';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	export let cases;
 | 
						export let cases;
 | 
				
			||||||
@ -131,15 +132,19 @@
 | 
				
			|||||||
							stroke-width={2}
 | 
												stroke-width={2}
 | 
				
			||||||
							opacity={0.5}
 | 
												opacity={0.5}
 | 
				
			||||||
						></line>
 | 
											></line>
 | 
				
			||||||
						<rect
 | 
											<Square
 | 
				
			||||||
							x={xScale(event.date) - 6}
 | 
												x={xScale(event.date)}
 | 
				
			||||||
							y={yScale('Key event') - 6}
 | 
												y={yScale('Key event')}
 | 
				
			||||||
							width={12}
 | 
												width={12}
 | 
				
			||||||
							height={12}
 | 
					 | 
				
			||||||
							fill={colorScale('Key event')}
 | 
												fill={colorScale('Key event')}
 | 
				
			||||||
							stroke={'#ffffff'}
 | 
												stroke={'#ffffff'}
 | 
				
			||||||
							stroke-width={2}
 | 
												stroke-width={2}
 | 
				
			||||||
						></rect>
 | 
												ttContent={`<p class="countryname">${event.title}</p>`}
 | 
				
			||||||
 | 
													bind:tooltipContent
 | 
				
			||||||
 | 
													bind:tooltipX
 | 
				
			||||||
 | 
													bind:tooltipY
 | 
				
			||||||
 | 
													bind:showTooltip
 | 
				
			||||||
 | 
											></Square>
 | 
				
			||||||
					{/each}
 | 
										{/each}
 | 
				
			||||||
				{/if}
 | 
									{/if}
 | 
				
			||||||
			</g>
 | 
								</g>
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,7 @@
 | 
				
			|||||||
      background: rgba(255, 255, 255, 0.95);
 | 
					      background: rgba(255, 255, 255, 0.95);
 | 
				
			||||||
      transform: translate(0%, -200%);
 | 
					      transform: translate(0%, -200%);
 | 
				
			||||||
      padding: 5px;
 | 
					      padding: 5px;
 | 
				
			||||||
      z-index: 15;
 | 
					      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;
 | 
					      width: 300px;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Загрузка…
	
	
			
			x
			
			
		
	
		Ссылка в новой задаче
	
	Block a user