node-mac-recorder 2.17.6 → 2.17.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.17.6",
3
+ "version": "2.17.7",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -128,7 +128,7 @@ NSString* getCursorType() {
128
128
  cursorType = @"col-resize"; // default
129
129
  }
130
130
  }
131
- // SCROLL CURSORS
131
+ // SCROLL CURSORS - sadece gerçek scroll kontrollerinde
132
132
  else if ([elementRole isEqualToString:@"AXScrollBar"]) {
133
133
  // Check orientation for scroll direction
134
134
  CFStringRef orientation = NULL;
@@ -141,11 +141,13 @@ NSString* getCursorType() {
141
141
  cursorType = @"col-resize"; // horizontal scrollbar
142
142
  }
143
143
  } else {
144
- cursorType = @"all-scroll";
144
+ cursorType = @"default"; // fallback to default
145
145
  }
146
146
  }
147
+ // AXScrollArea için sadece belirli durumlarda all-scroll, çoğunlukla default
147
148
  else if ([elementRole isEqualToString:@"AXScrollArea"]) {
148
- cursorType = @"all-scroll";
149
+ // ScrollArea genellikle default olmalı, sadece özel durumlar için all-scroll
150
+ cursorType = @"default";
149
151
  }
150
152
  // CROSSHAIR CURSORS (drawing/selection tools)
151
153
  else if ([elementRole isEqualToString:@"AXCanvas"] ||
@@ -166,50 +168,72 @@ NSString* getCursorType() {
166
168
  cursorType = @"not-allowed";
167
169
  }
168
170
  }
169
- // WINDOW BORDER RESIZE
171
+ // WINDOW BORDER RESIZE - sadece pencere kenarlarında
170
172
  else if ([elementRole isEqualToString:@"AXWindow"]) {
171
- // Check mouse position relative to window bounds for resize detection
172
- CFTypeRef position = NULL;
173
- CFTypeRef size = NULL;
174
- error = AXUIElementCopyAttributeValue(elementAtPosition, kAXPositionAttribute, &position);
175
- AXError sizeError = AXUIElementCopyAttributeValue(elementAtPosition, kAXSizeAttribute, &size);
176
-
177
- if (error == kAXErrorSuccess && sizeError == kAXErrorSuccess && position && size) {
178
- CGPoint windowPos;
179
- CGSize windowSize;
180
- AXValueGetValue((AXValueRef)position, kAXValueTypeCGPoint, &windowPos);
181
- AXValueGetValue((AXValueRef)size, kAXValueTypeCGSize, &windowSize);
182
-
183
- CGFloat x = cursorPos.x - windowPos.x;
184
- CGFloat y = cursorPos.y - windowPos.y;
185
- CGFloat w = windowSize.width;
186
- CGFloat h = windowSize.height;
187
- CGFloat edge = 5.0; // 5px edge detection
188
-
189
- // Corner resize detection
190
- if ((x <= edge && y <= edge) || (x >= w-edge && y >= h-edge)) {
191
- cursorType = @"nwse-resize"; // Top-left or bottom-right corner
192
- }
193
- else if ((x >= w-edge && y <= edge) || (x <= edge && y >= h-edge)) {
194
- cursorType = @"nesw-resize"; // Top-right or bottom-left corner
195
- }
196
- // Edge resize detection
197
- else if (x <= edge || x >= w-edge) {
198
- cursorType = @"col-resize"; // Left or right edge
199
- }
200
- else if (y <= edge || y >= h-edge) {
201
- cursorType = @"row-resize"; // Top or bottom edge
202
- }
203
- else {
173
+ // Check window attributes to see if it's resizable
174
+ CFBooleanRef resizable = NULL;
175
+ AXError resizableError = AXUIElementCopyAttributeValue(elementAtPosition, CFSTR("AXResizeButton"), (CFTypeRef*)&resizable);
176
+
177
+ // Sadece resize edilebilir pencereler için cursor değişimi
178
+ if (resizableError == kAXErrorSuccess || true) { // AXResizeButton bulunamazsa da devam et
179
+ CFTypeRef position = NULL;
180
+ CFTypeRef size = NULL;
181
+ error = AXUIElementCopyAttributeValue(elementAtPosition, kAXPositionAttribute, &position);
182
+ AXError sizeError = AXUIElementCopyAttributeValue(elementAtPosition, kAXSizeAttribute, &size);
183
+
184
+ if (error == kAXErrorSuccess && sizeError == kAXErrorSuccess && position && size) {
185
+ CGPoint windowPos;
186
+ CGSize windowSize;
187
+ AXValueGetValue((AXValueRef)position, kAXValueTypeCGPoint, &windowPos);
188
+ AXValueGetValue((AXValueRef)size, kAXValueTypeCGSize, &windowSize);
189
+
190
+ CGFloat x = cursorPos.x - windowPos.x;
191
+ CGFloat y = cursorPos.y - windowPos.y;
192
+ CGFloat w = windowSize.width;
193
+ CGFloat h = windowSize.height;
194
+ CGFloat edge = 3.0; // Daha küçük edge detection (3px)
195
+
196
+ // Sadece çok kenar köşelerde resize cursor'ı göster
197
+ BOOL isOnBorder = NO;
198
+
199
+ // Corner resize detection - çok dar alanda
200
+ if ((x <= edge && y <= edge) || (x >= w-edge && y >= h-edge)) {
201
+ cursorType = @"nwse-resize";
202
+ isOnBorder = YES;
203
+ }
204
+ else if ((x >= w-edge && y <= edge) || (x <= edge && y >= h-edge)) {
205
+ cursorType = @"nesw-resize";
206
+ isOnBorder = YES;
207
+ }
208
+ // Edge resize detection - sadece çok kenarlarda
209
+ else if ((x <= edge || x >= w-edge) && y > edge && y < h-edge) {
210
+ cursorType = @"col-resize";
211
+ isOnBorder = YES;
212
+ }
213
+ else if ((y <= edge || y >= h-edge) && x > edge && x < w-edge) {
214
+ cursorType = @"row-resize";
215
+ isOnBorder = YES;
216
+ }
217
+
218
+ // Eğer border'da değilse default
219
+ if (!isOnBorder) {
220
+ cursorType = @"default";
221
+ }
222
+
223
+ if (position) CFRelease(position);
224
+ if (size) CFRelease(size);
225
+ } else {
204
226
  cursorType = @"default";
205
227
  }
206
-
207
- if (position) CFRelease(position);
208
- if (size) CFRelease(size);
209
228
  } else {
210
229
  cursorType = @"default";
211
230
  }
212
231
  }
232
+ // HER DURUM İÇİN DEFAULT FALLBACK
233
+ else {
234
+ // Bilinmeyen elementler için her zaman default
235
+ cursorType = @"default";
236
+ }
213
237
 
214
238
  // Check subroles for additional context
215
239
  CFStringRef subrole = NULL;
@@ -218,14 +242,14 @@ NSString* getCursorType() {
218
242
  NSString *elementSubrole = (__bridge_transfer NSString*)subrole;
219
243
  NSLog(@"🎯 ELEMENT SUBROLE: %@", elementSubrole);
220
244
 
221
- // Special button subroles
245
+ // Subrole override'ları - sadece çok spesifik durumlar için
222
246
  if ([elementSubrole isEqualToString:@"AXCloseButton"] ||
223
247
  [elementSubrole isEqualToString:@"AXMinimizeButton"] ||
224
248
  [elementSubrole isEqualToString:@"AXZoomButton"] ||
225
249
  [elementSubrole isEqualToString:@"AXToolbarButton"]) {
226
250
  cursorType = @"pointer";
227
251
  }
228
- // Copy/alias subroles
252
+ // Copy/alias subroles - sadece bu durumlar için override
229
253
  else if ([elementSubrole isEqualToString:@"AXFileDrop"] ||
230
254
  [elementSubrole isEqualToString:@"AXDropTarget"]) {
231
255
  cursorType = @"copy";
@@ -235,18 +259,19 @@ NSString* getCursorType() {
235
259
  [elementSubrole isEqualToString:@"AXShortcut"]) {
236
260
  cursorType = @"alias";
237
261
  }
238
- // Grabbing state (being dragged)
262
+ // Grabbing state (being dragged) - sadece gerçek drag sırasında
239
263
  else if ([elementSubrole isEqualToString:@"AXDragging"] ||
240
264
  [elementSubrole isEqualToString:@"AXMoving"]) {
241
265
  cursorType = @"grabbing";
242
266
  }
243
- // Zoom controls
267
+ // Zoom controls - sadece spesifik zoom butonları için
244
268
  else if ([elementSubrole isEqualToString:@"AXZoomIn"]) {
245
269
  cursorType = @"zoom-in";
246
270
  }
247
271
  else if ([elementSubrole isEqualToString:@"AXZoomOut"]) {
248
272
  cursorType = @"zoom-out";
249
273
  }
274
+ // Subrole'dan bir şey bulamazsa role-based cursor'ı koruyoruz
250
275
  }
251
276
  }
252
277
 
@@ -257,6 +282,11 @@ NSString* getCursorType() {
257
282
  CFRelease(systemWide);
258
283
  }
259
284
 
285
+ // Son güvence - eğer cursorType hala nil veya geçersizse default'a çevir
286
+ if (!cursorType || [cursorType length] == 0) {
287
+ cursorType = @"default";
288
+ }
289
+
260
290
  NSLog(@"🎯 FINAL CURSOR TYPE: %@", cursorType);
261
291
  return cursorType;
262
292