@hi-ashleyj/llama 0.8.0 → 0.8.1
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.
- package/components/Layer.svelte +5 -5
- package/package.json +1 -1
package/components/Layer.svelte
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { onMount } from "svelte";
|
|
3
3
|
export let zIndex = 0;
|
|
4
4
|
export let staticMode = false;
|
|
5
|
-
let
|
|
5
|
+
let shouldRenderNextFrame = true;
|
|
6
6
|
let canvas;
|
|
7
7
|
$: ctx = (typeof canvas !== "undefined") ? canvas.getContext("2d") : null;
|
|
8
8
|
let targets = new Set();
|
|
@@ -21,12 +21,12 @@ let register = setupLayer({
|
|
|
21
21
|
requestFrame: () => {
|
|
22
22
|
if (!staticMode)
|
|
23
23
|
return;
|
|
24
|
-
|
|
24
|
+
shouldRenderNextFrame = true;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
onMount(() => {
|
|
28
|
-
return register({ draw, isStatic: () => { if (
|
|
29
|
-
|
|
28
|
+
return register({ draw, isStatic: () => { if (shouldRenderNextFrame) {
|
|
29
|
+
shouldRenderNextFrame = false;
|
|
30
30
|
draw();
|
|
31
31
|
} return staticMode; } });
|
|
32
32
|
});
|
|
@@ -44,4 +44,4 @@ onMount(() => {
|
|
|
44
44
|
height: 100%;
|
|
45
45
|
object-fit: contain;
|
|
46
46
|
}
|
|
47
|
-
</style>
|
|
47
|
+
</style>
|