node-mac-recorder 2.17.3 → 2.17.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,8 @@
3
3
  "allow": [
4
4
  "Bash(node:*)",
5
5
  "Bash(chmod:*)",
6
- "Bash(cat:*)"
6
+ "Bash(cat:*)",
7
+ "Bash(git checkout:*)"
7
8
  ],
8
9
  "deny": [],
9
10
  "ask": []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.17.3",
3
+ "version": "2.17.5",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -58,11 +58,15 @@ NSString* getCursorType() {
58
58
  // Get current cursor info
59
59
  NSCursor *currentCursor = [NSCursor currentSystemCursor];
60
60
  NSString *cursorType = @"default";
61
-
61
+
62
62
  // Get cursor image info
63
63
  NSImage *cursorImage = [currentCursor image];
64
64
  NSPoint hotSpot = [currentCursor hotSpot];
65
65
  NSSize imageSize = [cursorImage size];
66
+
67
+ // DEBUG: Log cursor details
68
+ NSLog(@"🖱️ CURSOR DEBUG: size=(%.0f,%.0f), hotspot=(%.0f,%.0f)",
69
+ imageSize.width, imageSize.height, hotSpot.x, hotSpot.y);
66
70
 
67
71
  // Check cursor type by comparing with standard cursors
68
72
  if ([currentCursor isEqual:[NSCursor pointingHandCursor]] ||
@@ -76,7 +80,7 @@ NSString* getCursorType() {
76
80
  } else if ([currentCursor isEqual:[NSCursor resizeLeftRightCursor]]) {
77
81
  return @"col-resize";
78
82
  } else if ([currentCursor isEqual:[NSCursor resizeUpDownCursor]]) {
79
- return @"row-resize";
83
+ return @"ns-resize";
80
84
  } else if ([currentCursor isEqual:[NSCursor openHandCursor]]) {
81
85
  return @"grab";
82
86
  } else if ([currentCursor isEqual:[NSCursor closedHandCursor]]) {
@@ -93,47 +97,109 @@ NSString* getCursorType() {
93
97
  return @"help";
94
98
  }
95
99
 
96
- // Additional cursor type detection by image characteristics
100
+ // Additional detection based on image characteristics
97
101
  if (imageSize.width > 0 && imageSize.height > 0) {
98
- // Progress cursor (spinning wheel or hourglass)
99
- if (imageSize.width >= 16 && imageSize.height >= 16 &&
100
- imageSize.width <= 32 && imageSize.height <= 32 &&
101
- hotSpot.x >= imageSize.width/2 - 4 && hotSpot.x <= imageSize.width/2 + 4 &&
102
- hotSpot.y >= imageSize.height/2 - 4 && hotSpot.y <= imageSize.height/2 + 4) {
103
- return @"progress";
102
+ NSLog(@"🖱️ Checking cursor: size=(%.0f,%.0f), hotspot=(%.0f,%.0f)",
103
+ imageSize.width, imageSize.height, hotSpot.x, hotSpot.y);
104
+
105
+ // Hand cursors (grab/grabbing) - different from regular cursors
106
+ // Looking for cursors that are NOT the common patterns we know
107
+ bool isKnownPattern = false;
108
+
109
+ // Text cursor: narrow tall with centered hotspot
110
+ if (imageSize.width <= 12 && imageSize.height >= 16 &&
111
+ hotSpot.x >= imageSize.width/2 - 2 && hotSpot.x <= imageSize.width/2 + 2) {
112
+ isKnownPattern = true;
104
113
  }
105
114
 
106
- // Zoom cursors (magnifying glass)
107
- if ((imageSize.width >= 20 && imageSize.width <= 28) &&
108
- (imageSize.height >= 20 && imageSize.height <= 28)) {
109
- // Try to differentiate zoom-in vs zoom-out by hotspot position
110
- if (hotSpot.x < imageSize.width/2) {
111
- return @"zoom-out";
112
- } else {
113
- return @"zoom-in";
114
- }
115
+ // Pointer cursor: larger with off-center hotspot
116
+ if ((imageSize.width >= 28 && imageSize.height >= 32 && hotSpot.x <= 8) ||
117
+ (imageSize.width == 32 && imageSize.height == 32 && hotSpot.x <= 15 && hotSpot.y <= 10)) {
118
+ isKnownPattern = true;
115
119
  }
116
120
 
117
- // All-scroll cursor (four arrows)
118
- if (imageSize.width >= 16 && imageSize.height >= 16 &&
119
- hotSpot.x >= imageSize.width/2 - 2 && hotSpot.x <= imageSize.width/2 + 2 &&
120
- hotSpot.y >= imageSize.height/2 - 2 && hotSpot.y <= imageSize.height/2 + 2) {
121
- return @"all-scroll";
121
+ // Default cursor: 32x32 with center hotspot
122
+ if (imageSize.width == 32 && imageSize.height == 32 &&
123
+ hotSpot.x >= 14 && hotSpot.x <= 18 && hotSpot.y >= 14 && hotSpot.y <= 18) {
124
+ isKnownPattern = true;
122
125
  }
123
126
 
124
- // Diagonal resize cursors
125
- if (imageSize.width >= 14 && imageSize.width <= 20 &&
126
- imageSize.height >= 14 && imageSize.height <= 20) {
127
- // NW-SE resize (top-left to bottom-right)
128
- if (hotSpot.x >= 7 && hotSpot.x <= 13 && hotSpot.y >= 7 && hotSpot.y <= 13) {
129
- return @"nwse-resize";
127
+ // Special cursor patterns detection
128
+ if (!isKnownPattern) {
129
+ // Progress cursor (loading/spinning) - usually larger, center hotspot
130
+ if (imageSize.width >= 24 && imageSize.width <= 40 &&
131
+ imageSize.height >= 24 && imageSize.height <= 40 &&
132
+ hotSpot.x >= imageSize.width/2 - 4 && hotSpot.x <= imageSize.width/2 + 4 &&
133
+ hotSpot.y >= imageSize.height/2 - 4 && hotSpot.y <= imageSize.height/2 + 4) {
134
+ NSLog(@"🖱️ DETECTED PROGRESS: size=(%.0f,%.0f), hotspot=(%.0f,%.0f)",
135
+ imageSize.width, imageSize.height, hotSpot.x, hotSpot.y);
136
+ return @"progress";
137
+ }
138
+
139
+ // Zoom cursors (magnifying glass) - distinctive size/hotspot patterns
140
+ if (imageSize.width >= 18 && imageSize.width <= 30 &&
141
+ imageSize.height >= 18 && imageSize.height <= 30) {
142
+ // Zoom-in usually has hotspot in center or slightly off
143
+ if (hotSpot.x >= imageSize.width/2 - 3 && hotSpot.x <= imageSize.width/2 + 3) {
144
+ NSLog(@"🖱️ DETECTED ZOOM-IN: size=(%.0f,%.0f)", imageSize.width, imageSize.height);
145
+ return @"zoom-in";
146
+ }
147
+ // Zoom-out usually has different hotspot pattern
148
+ else {
149
+ NSLog(@"🖱️ DETECTED ZOOM-OUT: size=(%.0f,%.0f)", imageSize.width, imageSize.height);
150
+ return @"zoom-out";
151
+ }
152
+ }
153
+
154
+ // All-scroll cursor (move in all directions) - usually square with center hotspot
155
+ if (imageSize.width >= 16 && imageSize.width <= 24 &&
156
+ imageSize.height >= 16 && imageSize.height <= 24 &&
157
+ abs(imageSize.width - imageSize.height) <= 2 &&
158
+ hotSpot.x >= imageSize.width/2 - 2 && hotSpot.x <= imageSize.width/2 + 2 &&
159
+ hotSpot.y >= imageSize.height/2 - 2 && hotSpot.y <= imageSize.height/2 + 2) {
160
+ NSLog(@"🖱️ DETECTED ALL-SCROLL: size=(%.0f,%.0f)", imageSize.width, imageSize.height);
161
+ return @"all-scroll";
130
162
  }
131
- // NE-SW resize (top-right to bottom-left)
132
- if (hotSpot.x >= 7 && hotSpot.x <= 13 && hotSpot.y >= 7 && hotSpot.y <= 13) {
133
- return @"nesw-resize";
163
+
164
+ // Diagonal resize cursors - typically 16x16 or similar
165
+ if (imageSize.width >= 14 && imageSize.width <= 20 &&
166
+ imageSize.height >= 14 && imageSize.height <= 20) {
167
+ // NW-SE resize (diagonal top-left to bottom-right)
168
+ if (hotSpot.x <= imageSize.width/2 && hotSpot.y <= imageSize.height/2) {
169
+ NSLog(@"🖱️ DETECTED NWSE-RESIZE: size=(%.0f,%.0f)", imageSize.width, imageSize.height);
170
+ return @"nwse-resize";
171
+ }
172
+ // NE-SW resize (diagonal top-right to bottom-left)
173
+ else if (hotSpot.x >= imageSize.width/2 && hotSpot.y <= imageSize.height/2) {
174
+ NSLog(@"🖱️ DETECTED NESW-RESIZE: size=(%.0f,%.0f)", imageSize.width, imageSize.height);
175
+ return @"nesw-resize";
176
+ }
177
+ // Row resize (vertical resize)
178
+ else if (abs(hotSpot.x - imageSize.width/2) <= 2) {
179
+ NSLog(@"🖱️ DETECTED ROW-RESIZE: size=(%.0f,%.0f)", imageSize.width, imageSize.height);
180
+ return @"row-resize";
181
+ }
182
+ }
183
+
184
+ // Hand cursors (grab/grabbing) - medium-sized, various hotspots
185
+ if (imageSize.width >= 14 && imageSize.width <= 24 &&
186
+ imageSize.height >= 14 && imageSize.height <= 24) {
187
+ NSLog(@"🖱️ POTENTIAL GRAB/GRABBING: size=(%.0f,%.0f), hotspot=(%.0f,%.0f)",
188
+ imageSize.width, imageSize.height, hotSpot.x, hotSpot.y);
189
+
190
+ // Try to differentiate grab vs grabbing by hotspot position
191
+ if (hotSpot.x >= imageSize.width/2 - 2 && hotSpot.x <= imageSize.width/2 + 2 &&
192
+ hotSpot.y >= imageSize.height/2 - 2 && hotSpot.y <= imageSize.height/2 + 2) {
193
+ NSLog(@"🖱️ DETECTED GRAB (center hotspot)");
194
+ return @"grab";
195
+ } else {
196
+ NSLog(@"🖱️ DETECTED GRABBING (off-center hotspot)");
197
+ return @"grabbing";
198
+ }
134
199
  }
135
200
  }
136
201
  }
202
+
137
203
 
138
204
  // Check if we're in a drag operation
139
205
  CGEventRef event = CGEventCreate(NULL);