Web-based Eye Tracking Code Editor

By Ningzhi Tang@SaNDwich Lab, October 2024

From the data stream of eye gaze or mouse pointer coordinates on the screen, this tool can automatically compute the corresponding code semantic information (e.g., line, column, token, and AST chain) in real time.

It includes features like code highlighting, robust handling of scrolling, and support for code editing, eliminating the need for labor-intensive and inaccurate post-processing (e.g., computer vision-based methods).

  • Gaze (mouse) position on screen: X: 0, Y: 0
  • Gaze (mouse) position on window: X: 0, Y: 0
  • Gaze (mouse) is over line 0, column 0
    • Token:
    • AST chain:
public class TwoSum {
public int[] twoSum(int[] nums, int target) {
for (int i = 0; i < nums.length; i++) {
for (int j = i + 1; j < nums.length; j++) {
// If the sum of the two numbers is equal to target
if (nums[j] == target - nums[i]) {
return new int[]{i, j};
}
}
}
throw new IllegalArgumentException("No two sum solution");
}

public static void main(String[] args) {
TwoSum twoSum = new TwoSum();
int[] nums = {2, 7, 11, 15};
int target = 9;
int[] result = twoSum.twoSum(nums, target);
System.out.println("[" + result[0] + ", " + result[1] + "]");
}
}