layerchart 0.36.3 → 0.36.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,13 +14,13 @@ const geo = geoContext();
|
|
|
14
14
|
$: tile = d3Tile()
|
|
15
15
|
.size([$width, $height])
|
|
16
16
|
.scale($geo.scale() * 2 * Math.PI)
|
|
17
|
-
.translate($geo([0, 0]))
|
|
17
|
+
.translate($geo([0, 0]) ?? [0, 0]) // TODO: Only works with Mercator
|
|
18
18
|
.tileSize(tileSize)
|
|
19
19
|
.zoomDelta(zoomDelta);
|
|
20
20
|
$: tiles = tile();
|
|
21
21
|
$: ({
|
|
22
22
|
translate: [tx, ty],
|
|
23
|
-
scale: k
|
|
23
|
+
scale: k,
|
|
24
24
|
} = tiles);
|
|
25
25
|
$: renderContext = canvas ? 'canvas' : 'svg';
|
|
26
26
|
$: ctx = canvas?.ctx;
|
|
@@ -6,32 +6,35 @@ const geo = geoContext();
|
|
|
6
6
|
let showCenter = false;
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
|
-
<div class={cls('bg-
|
|
10
|
-
<div class="grid gap-2
|
|
11
|
-
<div><span class="
|
|
9
|
+
<div class={cls('bg-surface-300/50 rounded m-1 backdrop-blur p-2 tabular-nums', $$props.class)}>
|
|
10
|
+
<div class="grid gap-2 text-xs">
|
|
11
|
+
<div><span class="opacity-50">scale:</span> {format($geo.scale(), 'decimal')}</div>
|
|
12
12
|
|
|
13
13
|
<div>
|
|
14
|
-
<span class="
|
|
14
|
+
<span class="opacity-50">translate:</span>
|
|
15
15
|
{#each $geo.translate() as coord}
|
|
16
|
-
<div class="
|
|
16
|
+
<div class="text-right">{format(coord, 'decimal')}</div>
|
|
17
17
|
{/each}
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
<div>
|
|
21
|
-
<span class="
|
|
21
|
+
<span class="opacity-50">rotate:</span>
|
|
22
22
|
{#each $geo.rotate() as angle}
|
|
23
|
-
<div class="
|
|
23
|
+
<div class="text-right">{format(angle, 'decimal')}</div>
|
|
24
24
|
{/each}
|
|
25
25
|
</div>
|
|
26
26
|
|
|
27
|
-
<div
|
|
27
|
+
<div class="grid grid-cols-[auto,1fr]">
|
|
28
|
+
<span class="opacity-50">center:</span>
|
|
29
|
+
<span class="text-right">
|
|
30
|
+
{$geo.center?.()}
|
|
31
|
+
</span>
|
|
32
|
+
</div>
|
|
28
33
|
|
|
29
34
|
<div>
|
|
30
|
-
<span class="
|
|
31
|
-
>long/lat: <Checkbox bind:checked={showCenter} size="xs" /></span
|
|
32
|
-
>
|
|
35
|
+
<span class="opacity-50">long/lat: <Checkbox bind:checked={showCenter} size="xs" /></span>
|
|
33
36
|
{#each $geo.invert?.([$width / 2, $height / 2]) as coord}
|
|
34
|
-
<div class="
|
|
37
|
+
<div class="text-right">{format(coord, 'decimal')}</div>
|
|
35
38
|
{/each}
|
|
36
39
|
</div>
|
|
37
40
|
</div>
|
|
@@ -7,7 +7,7 @@ export let orientation = 'vertical';
|
|
|
7
7
|
|
|
8
8
|
<div
|
|
9
9
|
class={cls(
|
|
10
|
-
'bg-surface-
|
|
10
|
+
'bg-surface-300/50 rounded-full m-1 backdrop-blur z-10 flex',
|
|
11
11
|
orientation === 'vertical' && 'flex-col',
|
|
12
12
|
{
|
|
13
13
|
'top-left': 'absolute top-0 left-0',
|
|
@@ -26,28 +26,28 @@ export let orientation = 'vertical';
|
|
|
26
26
|
<Button
|
|
27
27
|
icon={mdiMagnifyPlusOutline}
|
|
28
28
|
on:click={() => transform.zoomIn()}
|
|
29
|
-
class="text-surface-content
|
|
29
|
+
class="text-surface-content p-2"
|
|
30
30
|
/>
|
|
31
31
|
</Tooltip>
|
|
32
32
|
<Tooltip title="Zoom out">
|
|
33
33
|
<Button
|
|
34
34
|
icon={mdiMagnifyMinusOutline}
|
|
35
35
|
on:click={() => transform.zoomOut()}
|
|
36
|
-
class="text-surface-content
|
|
36
|
+
class="text-surface-content p-2"
|
|
37
37
|
/>
|
|
38
38
|
</Tooltip>
|
|
39
39
|
<Tooltip title="Center">
|
|
40
40
|
<Button
|
|
41
41
|
icon={mdiImageFilterCenterFocus}
|
|
42
42
|
on:click={() => transform.translateCenter()}
|
|
43
|
-
class="text-surface-content
|
|
43
|
+
class="text-surface-content p-2"
|
|
44
44
|
/>
|
|
45
45
|
</Tooltip>
|
|
46
46
|
<Tooltip title="Reset">
|
|
47
47
|
<Button
|
|
48
48
|
icon={mdiArrowULeftTop}
|
|
49
49
|
on:click={() => transform.reset()}
|
|
50
|
-
class="text-surface-content
|
|
50
|
+
class="text-surface-content p-2"
|
|
51
51
|
/>
|
|
52
52
|
</Tooltip>
|
|
53
53
|
</div>
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED