X-Git-Url: https://git.r.bdr.sh/rbdr/canvas/blobdiff_plain/3717f7fbf9ec110b51fe002cdced5d73ebd6136b..2df937df1372359babd123d1361e702a1a4b8168:/src/lib/components/sensor.svelte?ds=inline

diff --git a/src/lib/components/sensor.svelte b/src/lib/components/sensor.svelte
index e69de29..da968a3 100644
--- a/src/lib/components/sensor.svelte
+++ b/src/lib/components/sensor.svelte
@@ -0,0 +1,34 @@
+<script>
+  import { browser } from '$app/env';
+  import { maxSize } from '$lib/config';
+
+  export let x;
+  export let y;
+
+  const kSensorSize = 2;
+
+  let left;
+  let right;
+  let top;
+  let bottom;
+
+  let timer;
+  const fetchItems = function fetchItems( left, top, right, bottom ) {
+    clearTimeout(timer);
+		timer = setTimeout(() => {
+      console.log('fetching', left, top, right, bottom);
+		}, 50);
+  }
+
+  $: {
+    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;
+
+      fetchItems(left, top, right, bottom);
+    }
+  }
+
+</script>
