layerchart 0.13.3 → 0.13.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.
|
@@ -8,14 +8,13 @@ export let leftOffset = 10;
|
|
|
8
8
|
export let contained = 'container'; // TODO: Support 'window' using getBoundingClientRect()
|
|
9
9
|
export let animate = true;
|
|
10
10
|
export let header = undefined;
|
|
11
|
-
const {
|
|
11
|
+
const { containerWidth, containerHeight } = getContext('LayerCake');
|
|
12
12
|
const tooltip = tooltipContext();
|
|
13
13
|
let tooltipWidth = 0;
|
|
14
14
|
let tooltipHeight = 0;
|
|
15
15
|
let top = animate ? spring($tooltip.top) : writable($tooltip.top);
|
|
16
16
|
$: if ($tooltip) {
|
|
17
|
-
|
|
18
|
-
if (contained === 'container' && $tooltip.top + topOffset + tooltipHeight > containerHeight) {
|
|
17
|
+
if (contained === 'container' && $tooltip.top + topOffset + tooltipHeight > $containerHeight) {
|
|
19
18
|
// change side
|
|
20
19
|
$top = $tooltip.top - (topOffset + tooltipHeight);
|
|
21
20
|
}
|
|
@@ -25,8 +24,7 @@ $: if ($tooltip) {
|
|
|
25
24
|
}
|
|
26
25
|
let left = animate ? spring($tooltip.left) : writable($tooltip.left);
|
|
27
26
|
$: if ($tooltip) {
|
|
28
|
-
|
|
29
|
-
if (contained === 'container' && $tooltip.left + leftOffset + tooltipWidth > containerWidth) {
|
|
27
|
+
if (contained === 'container' && $tooltip.left + leftOffset + tooltipWidth > $containerWidth) {
|
|
30
28
|
// change side
|
|
31
29
|
$left = $tooltip.left - (leftOffset + tooltipWidth);
|
|
32
30
|
}
|
package/package.json
CHANGED