]> git.r.bdr.sh - rbdr/canvas/blobdiff - src/lib/components/sensor.svelte
Render cases when the boundary crosses the viewport
[rbdr/canvas] / src / lib / components / sensor.svelte
index e98b74086b30b208c3f349fc527f7ca6c3a0d736..3b7dfc2724643f177dff50bc18ed73b2d6a27a44 100644 (file)
@@ -1,11 +1,9 @@
 <script>
   import { browser } from '$app/env';
   import { maxSize } from '$lib/config';
+  import { canvas } from '$lib/stores/canvas';
   import { sensor } from '$lib/stores/widgets';
 
-  export let x;
-  export let y;
-
   const kSensorSize = 2;
 
   let left;
 
   $: {
     if (browser) {
-      left = x - window.screen.width * kSensorSize;
-      top = y - window.screen.height * kSensorSize;
-      right = x + window.screen.width * kSensorSize;
-      bottom = y + window.screen.height * kSensorSize;
+      left = $canvas.x - window.screen.width * kSensorSize;
+      top = $canvas.y - window.screen.height * kSensorSize;
+      right = $canvas.x + window.screen.width * kSensorSize;
+      bottom = $canvas.y + window.screen.height * kSensorSize;
 
       fetchItems(left, top, right, bottom);
     }