node-mac-recorder 2.24.14 → 2.24.16

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/CURSOR_MAPPING.md CHANGED
@@ -19,25 +19,25 @@ Bu dosya, macOS native cursor type'larının Electron/CSS cursor constant'ların
19
19
  | `CURSOR_TYPES.copy` | `copy` | `NSCursor.dragCopyCursor` | ✅ |
20
20
  | `CURSOR_TYPES.alias` | `alias` | `NSCursor.dragLinkCursor` | ✅ |
21
21
  | `CURSOR_TYPES["not-allowed"]` | `not-allowed` | `NSCursor.operationNotAllowedCursor` | ✅ |
22
- | `CURSOR_TYPES.help` | `help` | Pattern: "help", "question" | ✅ |
23
- | `CURSOR_TYPES.progress` | `progress` | Pattern: "progress", "wait", "busy" | ✅ |
22
+ | `CURSOR_TYPES.help` | `help` | HIServices `help` PNG/PDF | ✅ |
23
+ | `CURSOR_TYPES.progress` | `progress` | HIServices `busybutclickable` | ✅ |
24
24
 
25
25
  ### Zoom Cursor'lar
26
26
  | Electron Constant | CSS Value | macOS Native | Durum |
27
27
  |-------------------|-----------|--------------|--------|
28
28
  | `CURSOR_TYPES.crosshair` | `crosshair` | `NSCursor.crosshairCursor` | ✅ |
29
- | `CURSOR_TYPES["zoom-in"]` | `zoom-in` | Pattern: "zoom" + NOT "out" | ✅ |
30
- | `CURSOR_TYPES["zoom-out"]` | `zoom-out` | Pattern: "zoom" + "out" | ✅ |
29
+ | `CURSOR_TYPES["zoom-in"]` | `zoom-in` | `NSCursor.zoomInCursor` / HIServices `zoomin` | ✅ |
30
+ | `CURSOR_TYPES["zoom-out"]` | `zoom-out` | `NSCursor.zoomOutCursor` / HIServices `zoomout` | ✅ |
31
31
 
32
32
  ### Resize Cursor'lar
33
33
  | Electron Constant | CSS Value | macOS Native | Durum |
34
34
  |-------------------|-----------|--------------|--------|
35
35
  | `CURSOR_TYPES["row-resize"]` | `row-resize` | `NSCursor.resizeUpDownCursor` | ✅ |
36
36
  | `CURSOR_TYPES["col-resize"]` | `col-resize` | `NSCursor.resizeLeftRightCursor` | ✅ |
37
- | `CURSOR_TYPES["ns-resize"]` | `ns-resize` | maps to `row-resize` | ✅ |
38
- | `CURSOR_TYPES["nwse-resize"]` | `nwse-resize` | Pattern: "diagonal-down", "nwse" | ✅ |
39
- | `CURSOR_TYPES["nesw-resize"]` | `nesw-resize` | Pattern: "diagonal-up", "nesw" | ✅ |
40
- | `CURSOR_TYPES["all-scroll"]` | `all-scroll` | Pattern: "all-scroll", "omnidirectional" | ✅ |
37
+ | `CURSOR_TYPES["ns-resize"]` | `ns-resize` | Dikey frame resize; `row-resize` ayrı tutulur | ✅ |
38
+ | `CURSOR_TYPES["nwse-resize"]` | `nwse-resize` | Frame resize: sol üst / sağ alt | ✅ |
39
+ | `CURSOR_TYPES["nesw-resize"]` | `nesw-resize` | Frame resize: sağ üst / sol alt | ✅ |
40
+ | `CURSOR_TYPES["all-scroll"]` | `all-scroll` | HIServices `move` | ✅ |
41
41
 
42
42
  ### Mouse Events
43
43
  | Electron Constant | Event Type | Native Detection | Durum |
@@ -50,63 +50,42 @@ Bu dosya, macOS native cursor type'larının Electron/CSS cursor constant'ların
50
50
  | `MOUSE_EVENTS.WHEEL` | `wheel` | Scroll wheel events | ✅ |
51
51
  | `MOUSE_EVENTS.HOVER` | `hover` | Position stability | ✅ |
52
52
 
53
- ## 🔧 Detection Methods
53
+ ## Algılama sırası
54
54
 
55
- ### 1. Direct NSCursor Equality (En Güvenilir)
56
- ```objc
57
- if (cursor == [NSCursor arrowCursor]) return @"default";
58
- if (cursor == [NSCursor IBeamCursor]) return @"text";
59
- ```
60
-
61
- ### 2. Pattern Matching (Cursor Name/Description)
62
- ```objc
63
- if ([normalized containsString:@"resize"]) { ... }
64
- if ([normalized containsString:@"zoom"]) { ... }
65
- ```
55
+ 1. `NSCursor.currentSystemCursor` ile ekranın gerçek imleci alınır. Kayıt işlemi arka plandayken uygulamanın kendi `currentCursor` değeri kullanılmaz.
56
+ 2. Görselin piksel içeriği ve hotspot'u sistem imleçlerinin fingerprint'leriyle karşılaştırılır. AppKit görselleri ile HIServices PNG/PDF kaynaklarının 1x ve 2x temsilleri tanıtılır. Chromium/WebKit'in `move` gibi CoreCursor varyantları AppKit üzerinden, sistem gölgesi dahil render edilir; ham PDF aynı piksel görüntüsünü üretmez.
57
+ 3. macOS 15 ve üzerinde frame resize'ın sekiz kenar/köşe konumu ve içe/dışa/iki yönlü çeşitleri; row/column resize'ın tek ve çift yönleri ayrı ayrı tanıtılır.
58
+ 4. Görsel eşleşmezse bilinen imleç adları kullanılır. Tanınmayan görseller `default` olur; sadece boyutuna bakarak resize, zoom veya hand tipi atanmaz.
59
+ 5. Sonuç desktop'taki SVG tiplerine normalize edilir. `context-menu` → `default`, `wait` → `progress`, `move` → `all-scroll`; tek yönlü resize tipleri ilgili eksene dönüştürülür.
66
60
 
67
- ### 3. Shape-Based Detection (Hotspot + Aspect Ratio)
68
- ```objc
69
- // Text cursor: narrow (0.50), center hotspot (0.44, 0.50)
70
- // Arrow cursor: medium (0.74), top-left hotspot (0.24, 0.17)
71
- // Pointer cursor: square (1.00), left-center hotspot (0.41, 0.25)
72
- ```
61
+ `CGSCurrentCursorSeed` bir değişiklik sayacıdır; tip kimliği olarak kullanılmaz. Eski `MAC_RECORDER_CURSOR_MAP` dosyalarındaki `seed` alanları yok sayılır, fingerprint ve privateName eşleştirmeleri desteklenir. Accessibility tahminleri yalnızca debug çıktısındadır.
73
62
 
74
- ### 4. Accessibility API (Context-Aware)
75
- ```objc
76
- AXUIElementCopyElementAtPosition() → role → cursor type
77
- ```
63
+ Konum değişmese bile cursor tipi değiştiğinde hareket/drag örneği kaydedilir.
78
64
 
79
- ## 📝 Notlar
65
+ ## Test
80
66
 
81
- ### İyileştirmeler (Latest)
82
- - ✅ `ns-resize` → `row-resize` mapping (Electron uyumluluğu)
83
- - ✅ `all-scroll` pattern detection eklendi
84
- - ✅ `progress` (wait/busy yerine)
85
- - ✅ `contextualMenuCursor` → `pointer` mapping
67
+ macOS'ta, kurulu Node header'ları ve Xcode Command Line Tools ile:
86
68
 
87
- ### Bilinen Sınırlamalar
88
- - Custom cursor'lar (resim-based) sadece pattern matching ile detect edilir
89
- - Bazı uygulamalar custom cursor implementation kullanır (tam detection garanti edilemez)
90
- - Shape-based detection sadece temel cursor'lar için optimize edilmiş
69
+ ```sh
70
+ npm run test:cursor
71
+ ```
91
72
 
92
- ## 🧪 Test Etme
73
+ Test üretim kodunu derleyerek AppKit imleçlerini, bunların bağımsız 1x/2x bitmap kopyalarını, eski sistem kaynaklarını, isim eşleştirmelerini ve sabit konumdaki şekil değişikliklerini kontrol eder. AppKit sistem görsellerine erişim gerekir.
93
74
 
94
- Cursor detection'ı test etmek için:
75
+ Gerçek WindowServer imlecini de doğrulamak için:
95
76
 
96
- ```javascript
97
- const MacRecorder = require('./index.js');
98
- const recorder = new MacRecorder();
77
+ ```sh
78
+ MAC_RECORDER_TEST_LIVE_CURSOR=1 npm run test:cursor
79
+ ```
99
80
 
100
- // Start cursor tracking
101
- await recorder.startCursorCapture('cursor-test.json', {
102
- videoRelative: false
103
- });
81
+ Bu seçenek imlecin altında kısa süreli bir test penceresi açar; test bitince pencere kapanır, önceki uygulama ve imleç geri yüklenir. Test sırasında fareyi hareket ettirmeyin.
104
82
 
105
- // Move mouse over different UI elements
106
- // Stop after a few seconds
107
- await recorder.stopCursorCapture();
83
+ Gerçek Chromium CSS imleçleri ve `grab → grabbing → grab` basma/bırakma geçişi için (önce `npm run build`):
108
84
 
109
- // Check cursor-test.json for detected cursor types
85
+ ```sh
86
+ MAC_RECORDER_ELECTRON=/path/to/Electron.app/Contents/MacOS/Electron npm run test:cursor:electron
110
87
  ```
111
88
 
112
- Her cursor event'inde `cursorType` field'ı Electron constant'larınızla uyumlu olacaktır.
89
+ Bu test de kısa süreli bir pencere açar. Electron zaten test ortamında kuruluysa executable değişkeni gerekmez.
90
+
91
+ Bilinmeyen özel uygulama görselleri veya gelecekte macOS'un sistem imleç görüntüsünü sağlamadığı durumlar `default` dönebilir. macOS 15 öncesindeki sistemler HIServices kaynakları ve mevcut NSCursor factory'leri üzerinden desteklenir.
package/index.js CHANGED
@@ -2007,7 +2007,8 @@ class MacRecorder extends EventEmitter {
2007
2007
  this.cursorCaptureInterval = setInterval(() => {
2008
2008
  try {
2009
2009
  if (this.cursorCapturePaused) return;
2010
- const position = nativeBinding.getCursorPosition();
2010
+ // Geometry was resolved at capture start; scaleFactor is not used here.
2011
+ const position = nativeBinding.getCursorPosition(false);
2011
2012
  const timestamp = Date.now() - this.cursorCaptureStartTime - this.cursorPausedDurationMs;
2012
2013
 
2013
2014
  // Video-relative coordinate transformation for all recording types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.24.14",
3
+ "version": "2.24.16",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -34,6 +34,8 @@
34
34
  ],
35
35
  "scripts": {
36
36
  "test": "node test.js",
37
+ "test:cursor": "node --test tests/cursor-detection.test.cjs",
38
+ "test:cursor:electron": "node --test tests/cursor-electron.test.cjs",
37
39
  "install": "node install.js",
38
40
  "build": "node-gyp build",
39
41
  "rebuild": "node-gyp rebuild",