From d7cea96940ddeb764c7343e05526f611863019d8 Mon Sep 17 00:00:00 2001
From: Ruben Beltran del Rio <ruben@unlimited.pizza>
Date: Thu, 7 Jul 2022 23:14:18 +0200
Subject: Partially render the boxes

---
 src/lib/components/sensor.svelte | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

(limited to 'src/lib/components/sensor.svelte')

diff --git a/src/lib/components/sensor.svelte b/src/lib/components/sensor.svelte
index e98b740..3b7dfc2 100644
--- a/src/lib/components/sensor.svelte
+++ b/src/lib/components/sensor.svelte
@@ -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;
@@ -23,10 +21,10 @@
 
   $: {
     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);
     }
-- 
cgit 

