-export const sensor = writable({left: 0, top: 0, right: 0, bottom: 0});
-
-const getBoxes = function getBoxes ({left, top, right, bottom}) {
- const results = [
- `box.ov."((${left},${top}),(${right},${bottom}))"`,
- `box.ov."((${left+maxSize},${top+maxSize}),(${right+maxSize},${bottom+maxSize}))"`,
- `box.ov."((${left+maxSize},${top}),(${right+maxSize},${bottom}))"`,
- `box.ov."((${left},${top+maxSize}),(${right},${bottom+maxSize}))"`
- ];
-
- if (right > maxSize || bottom > maxSize) {
- return [...results,
- `box.ov."((${left-maxSize},${top-maxSize}),(${right-maxSize},${bottom-maxSize}))"`,
- `box.ov."((${left-maxSize},${top}),(${right-maxSize},${bottom}))"`,
- `box.ov."((${left},${top-maxSize}),(${right},${bottom-maxSize}))"`
- ];
- }
-
- return results
+export const sensor = writable({ left: 0, top: 0, right: 0, bottom: 0 });
+
+const getBoxes = function getBoxes({ left, top, right, bottom }) {
+ const results = [
+ `box.ov."((${left},${top}),(${right},${bottom}))"`,
+ `box.ov."((${left + maxSize},${top + maxSize}),(${right + maxSize},${bottom + maxSize}))"`,
+ `box.ov."((${left + maxSize},${top}),(${right + maxSize},${bottom}))"`,
+ `box.ov."((${left},${top + maxSize}),(${right},${bottom + maxSize}))"`,
+ `box.ov."((${left - maxSize},${top - maxSize}),(${right - maxSize},${bottom - maxSize}))"`,
+ `box.ov."((${left - maxSize},${top}),(${right - maxSize},${bottom}))"`,
+ `box.ov."((${left},${top - maxSize}),(${right},${bottom - maxSize}))"`
+ ];
+
+ return results;