diff --git a/index.js b/index.js
index 63eb0642..f03ffb68 100644
--- a/index.js
+++ b/index.js
@@ -121,34 +121,38 @@ function createWindow() {
mainWindow.loadFile('./tracker/index.html');
try {
setInterval(() => {
- mainWindow.webContents.executeJavaScript(`
+ if (mainWindow) {
+ if (mainWindow.webContents) {
+ mainWindow.webContents.executeJavaScript(`
document.activeElement.tagName.toUpperCase() !== 'INPUT' && document.activeElement.tagName.toUpperCase() !== 'TEXTAREA';
`).then((result) => {
- if (result) {
- mainWindow.webContents.sendInputEvent({ type: 'mouseDown', x: 0, y: 0, button: 'left', clickCount: 1 });
- mainWindow.webContents.sendInputEvent({ type: 'mouseUp', x: 0, y: 0, button: 'left', clickCount: 1 });
+ if (result) {
+ mainWindow.webContents.sendInputEvent({ type: 'mouseDown', x: 0, y: 0, button: 'left', clickCount: 1 });
+ mainWindow.webContents.sendInputEvent({ type: 'mouseUp', x: 0, y: 0, button: 'left', clickCount: 1 });
+ }
+ }).catch((error) => {
+ console.error(error);
+ });
+ // Get the position of the window
+ const windowPosition = mainWindow.getPosition();
+ const windowX = windowPosition[0];
+ const windowY = windowPosition[1];
+
+ // Get the size of the window
+ const windowSize = mainWindow.getSize();
+ const windowWidth = windowSize[0];
+ const windowHeight = windowSize[1];
+
+ // Calculate the coordinates relative to the window
+ const xRelative = screen.getCursorScreenPoint().x; // Adjust as needed
+ const yRelative = screen.getCursorScreenPoint().y; // Adjust as needed
+
+ const x = xRelative - windowX;
+ const y = yRelative - windowY - 50;
+ mainWindow.webContents.sendInputEvent(
+ { type: 'mouseMove', x: x, y: y });
}
- }).catch((error) => {
- console.error(error);
- });
- // Get the position of the window
- const windowPosition = mainWindow.getPosition();
- const windowX = windowPosition[0];
- const windowY = windowPosition[1];
-
- // Get the size of the window
- const windowSize = mainWindow.getSize();
- const windowWidth = windowSize[0];
- const windowHeight = windowSize[1];
-
- // Calculate the coordinates relative to the window
- const xRelative = screen.getCursorScreenPoint().x; // Adjust as needed
- const yRelative = screen.getCursorScreenPoint().y; // Adjust as needed
-
- const x = xRelative - windowX;
- const y = yRelative - windowY - 50;
- mainWindow.webContents.sendInputEvent(
- { type: 'mouseMove', x: x, y: y });
+ }
}, 1000);
} catch {
diff --git a/store.json b/store.json
index 0c19a7cb..548e59a7 100644
--- a/store.json
+++ b/store.json
@@ -1,5 +1,6 @@
{
"magnetometer": false,
"smoothingEnabled": false,
- "smoothinput": 0.5
+ "smoothinput": 0.5,
+ "magnetometerHaritoraXW-A30R71": true
}
\ No newline at end of file
diff --git a/tracker/index.html b/tracker/index.html
index c19ca4f8..69c6a6be 100644
--- a/tracker/index.html
+++ b/tracker/index.html
@@ -25,7 +25,7 @@
Experimental
Drift Correction
- Leave the trackers on a flat surface and press calibrate and wait 60 seconds,
+ Leave the trackers on a flat surface and press calibrate and wait 15 seconds,
this will apply an inverse rotation over time.
@@ -48,14 +48,8 @@