Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Fixed the Boundary Math in inZone()
- Original: The original formula calculated the right and bottom boundaries as zoneLeft + zoneRight and zoneTop + zoneBottom.
- New: Updated to directly compare against zoneRight and zoneBottom (mx < this.zoneRight and my < this.zoneBottom).
- Why: Since you passed absolute coordinates (1374, 3240, 3294, 4320) into tc.setZone(), adding them together inflated the touchscreen's virtual boundary into non-existent screen space, causing improper detection.
- 2. Added a Windows Low-Level Mouse Hook (SetWindowsHookEx)
- New: Added this.hook := DllCall("SetWindowsHookEx", ...) in __New() using hook ID 14 (WH_MOUSE_LL).
- Why: This tells Windows to report raw mouse and input event metadata directly to the script before processing them, giving the script visibility into what created the input event.
- 3. Hardware Touch Signature Detection (MouseHook)
- New: Created the MouseHook() method to inspect the dwExtraInfo and flags memory pointers of every cursor movement.
- Why: When you touch a screen, Windows appends a specific signature (0xFF510000 / 0x00FF5100) to the cursor event. Physical mice do not send this signature. When a touch signature is detected, the script sets an internal flag (this.isTouch := true).
- 4. Smart Movement Logic in update()
- Original: Triggered a snap-back strictly based on whether the cursor jumped across a distance greater than jumpThreshold (200 pixels).
- New: Replaced the condition with (this.isTouch or this.distance(...) > 1500) and added this.isTouch := false at the end of each cycle.
- Why:
- If isTouch is true, it snaps the pointer back instantly regardless of speed.
- If isTouch is false (meaning you moved your physical mouse), it ignores normal distance jumps, allowing your mouse to traverse across the Y-axis gap into your touchscreen freely.
- The distance threshold fallback was raised to 1500 to prevent screen-crossing leaps from falsely triggering as touch events.
Advertisement
Add Comment
Please, Sign In to add comment