node-mac-recorder 2.17.20 → 2.18.0
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/.claude/settings.local.json +3 -1
- package/cursor-data-1751364314136.json +1 -0
- package/cursor-data.json +1 -0
- package/index.js +51 -39
- package/package.json +1 -1
- package/publish.sh +31 -0
- package/src/cursor_tracker.mm +198 -419
- package/src/screen_capture_kit.mm +1 -34
- package/auto-front-demo.js +0 -71
- package/cursor-debug-test.js +0 -60
- package/cursor-dpr-test.js +0 -73
- package/cursor-macbook-test.js +0 -63
- package/cursor-permission-test.js +0 -46
- package/cursor-scaling-debug.js +0 -53
- package/cursor-simple-test.js +0 -26
- package/debug-audio.js +0 -79
- package/debug-coordinates.js +0 -69
- package/debug-macos14.js +0 -110
- package/debug-primary-window.js +0 -84
- package/debug-screen-selection.js +0 -81
- package/debug-window-selector.js +0 -178
- package/simple-api-example.js +0 -182
- package/test-cursor-fix.js +0 -105
- package/test-cursor-types.js +0 -117
- package/test-display-coordinates.js +0 -72
- package/test-integrated-recording.js +0 -120
- package/test-menubar-offset.js +0 -110
- package/test-output/temp_cursor_1758313956591.json +0 -1
- package/test-primary-cursor.js +0 -154
- package/test-primary-fix.js +0 -120
- package/test-recording-with-cursor.js +0 -83
- package/test-unified-cursor.js +0 -75
- package/test-window-recording.js +0 -149
- package/usage-examples.js +0 -202
- package/working-example.js +0 -94
- /package/{cursor-dpr-test.json → cursor-data-1751364226346.json} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
package/cursor-data.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"x":1151,"y":726,"timestamp":20,"cursorType":"text","type":"move"}
|
package/index.js
CHANGED
|
@@ -359,10 +359,53 @@ class MacRecorder extends EventEmitter {
|
|
|
359
359
|
// Start cursor tracking automatically with recording
|
|
360
360
|
let cursorOptions = {};
|
|
361
361
|
|
|
362
|
-
//
|
|
363
|
-
this.
|
|
364
|
-
|
|
365
|
-
|
|
362
|
+
// For window recording, use simplified window-relative coordinates
|
|
363
|
+
if (this.options.windowId) {
|
|
364
|
+
// Use cached window info from the earlier window detection
|
|
365
|
+
this.getWindows().then(windows => {
|
|
366
|
+
const targetWindow = windows.find(w => w.id === this.options.windowId);
|
|
367
|
+
if (targetWindow) {
|
|
368
|
+
// Start cursor capture with simplified window-relative tracking
|
|
369
|
+
this.startCursorCapture(cursorFilePath, {
|
|
370
|
+
windowRelative: true,
|
|
371
|
+
windowInfo: {
|
|
372
|
+
// Use original global window coordinates for reference
|
|
373
|
+
x: targetWindow.x,
|
|
374
|
+
y: targetWindow.y,
|
|
375
|
+
width: targetWindow.width,
|
|
376
|
+
height: targetWindow.height,
|
|
377
|
+
displayId: this.options.displayId,
|
|
378
|
+
// Persist capture area so we can rebuild global offsets reliably
|
|
379
|
+
captureArea: this.options.captureArea,
|
|
380
|
+
// Keep a snapshot of the window details for debugging/analytics
|
|
381
|
+
originalWindow: targetWindow,
|
|
382
|
+
// Store display info for multi-display coordinate fixes
|
|
383
|
+
targetDisplay: this.recordingDisplayInfo
|
|
384
|
+
}
|
|
385
|
+
}).catch(cursorError => {
|
|
386
|
+
console.warn('Window cursor tracking failed:', cursorError.message);
|
|
387
|
+
// Fallback to display recording
|
|
388
|
+
this.startCursorCapture(cursorFilePath).catch(fallbackError => {
|
|
389
|
+
console.warn('Fallback cursor tracking failed:', fallbackError.message);
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}).catch(error => {
|
|
394
|
+
console.warn('Could not get window info for cursor tracking:', error.message);
|
|
395
|
+
// Fallback to display cursor tracking
|
|
396
|
+
this.startCursorCapture(cursorFilePath).catch(cursorError => {
|
|
397
|
+
console.warn('Cursor tracking failed to start:', cursorError.message);
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
} else {
|
|
401
|
+
// For display recording, use display-relative cursor tracking
|
|
402
|
+
this.startCursorCapture(cursorFilePath, {
|
|
403
|
+
displayRelative: true,
|
|
404
|
+
displayInfo: this.recordingDisplayInfo
|
|
405
|
+
}).catch(cursorError => {
|
|
406
|
+
console.warn('Display cursor tracking failed:', cursorError.message);
|
|
407
|
+
});
|
|
408
|
+
}
|
|
366
409
|
|
|
367
410
|
// Timer başlat (progress tracking için)
|
|
368
411
|
this.recordingTimer = setInterval(() => {
|
|
@@ -456,11 +499,9 @@ class MacRecorder extends EventEmitter {
|
|
|
456
499
|
|
|
457
500
|
// Stop cursor tracking automatically
|
|
458
501
|
if (this.cursorCaptureInterval) {
|
|
459
|
-
|
|
460
|
-
this.stopCursorCapture();
|
|
461
|
-
} catch (cursorError) {
|
|
502
|
+
this.stopCursorCapture().catch(cursorError => {
|
|
462
503
|
console.warn('Cursor tracking failed to stop:', cursorError.message);
|
|
463
|
-
}
|
|
504
|
+
});
|
|
464
505
|
}
|
|
465
506
|
|
|
466
507
|
// Timer durdur
|
|
@@ -789,11 +830,9 @@ class MacRecorder extends EventEmitter {
|
|
|
789
830
|
|
|
790
831
|
if (this.cursorDisplayInfo) {
|
|
791
832
|
if (this.cursorDisplayInfo.windowRelative) {
|
|
792
|
-
// Window recording:
|
|
793
|
-
// This works correctly for both primary and secondary displays
|
|
833
|
+
// Window recording: Transform global → window-relative coordinates
|
|
794
834
|
x = position.x - this.cursorDisplayInfo.x;
|
|
795
835
|
y = position.y - this.cursorDisplayInfo.y;
|
|
796
|
-
|
|
797
836
|
coordinateSystem = "window-relative";
|
|
798
837
|
|
|
799
838
|
// Window bounds check - skip if cursor is outside window
|
|
@@ -875,34 +914,7 @@ class MacRecorder extends EventEmitter {
|
|
|
875
914
|
/**
|
|
876
915
|
* Cursor capture durdurur - dosya yazma işlemini sonlandırır
|
|
877
916
|
*/
|
|
878
|
-
stopCursorCapture() {
|
|
879
|
-
if (!this.cursorCaptureInterval) {
|
|
880
|
-
return false;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
try {
|
|
884
|
-
// Native cursor tracking'i durdur
|
|
885
|
-
const success = nativeBinding.stopCursorTracking();
|
|
886
|
-
|
|
887
|
-
this.cursorCaptureInterval = null;
|
|
888
|
-
this.cursorCaptureFile = null;
|
|
889
|
-
this.cursorCaptureStartTime = null;
|
|
890
|
-
|
|
891
|
-
this.emit("cursorCaptureStopped", {
|
|
892
|
-
timestamp: Date.now()
|
|
893
|
-
});
|
|
894
|
-
|
|
895
|
-
return success;
|
|
896
|
-
} catch (error) {
|
|
897
|
-
console.warn("Error stopping cursor tracking:", error.message);
|
|
898
|
-
return false;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* LEGACY: Eski JS-based cursor capture durdurmak için geriye uyumluluk
|
|
904
|
-
*/
|
|
905
|
-
async _legacyStopCursorCapture() {
|
|
917
|
+
async stopCursorCapture() {
|
|
906
918
|
return new Promise((resolve, reject) => {
|
|
907
919
|
try {
|
|
908
920
|
if (!this.cursorCaptureInterval) {
|
package/package.json
CHANGED
package/publish.sh
CHANGED
|
@@ -3,6 +3,37 @@
|
|
|
3
3
|
# Publish script for node-mac-recorder
|
|
4
4
|
# Usage: ./publish.sh <patch|minor|major> "commit message"
|
|
5
5
|
|
|
6
|
+
# Clean up development files before publishing
|
|
7
|
+
echo "🧹 Cleaning up development files..."
|
|
8
|
+
|
|
9
|
+
# Remove video files
|
|
10
|
+
echo " • Removing .mov and .mp4 files..."
|
|
11
|
+
find . -name "*.mov" -type f -delete 2>/dev/null
|
|
12
|
+
find . -name "*.mp4" -type f -delete 2>/dev/null
|
|
13
|
+
|
|
14
|
+
# Remove files containing specific keywords
|
|
15
|
+
echo " • Removing files containing test, debug, example, demo, sample..."
|
|
16
|
+
find . -type f -not -path "./node_modules/*" \( \
|
|
17
|
+
-name "*test*" -o \
|
|
18
|
+
-name "*debug*" -o \
|
|
19
|
+
-name "*example*" -o \
|
|
20
|
+
-name "*demo*" -o \
|
|
21
|
+
-name "*sample*" \
|
|
22
|
+
\) -delete 2>/dev/null
|
|
23
|
+
|
|
24
|
+
# Remove folders containing specific keywords
|
|
25
|
+
echo " • Removing folders containing test, debug, example, demo, sample..."
|
|
26
|
+
find . -type d -not -path "./node_modules/*" \( \
|
|
27
|
+
-name "*test*" -o \
|
|
28
|
+
-name "*debug*" -o \
|
|
29
|
+
-name "*example*" -o \
|
|
30
|
+
-name "*demo*" -o \
|
|
31
|
+
-name "*sample*" \
|
|
32
|
+
\) -exec rm -rf {} + 2>/dev/null
|
|
33
|
+
|
|
34
|
+
echo "✅ Cleanup completed"
|
|
35
|
+
echo ""
|
|
36
|
+
|
|
6
37
|
# Check if correct number of arguments provided
|
|
7
38
|
if [ $# -ne 2 ]; then
|
|
8
39
|
echo "❌ Usage: $0 <patch|minor|major> \"commit message\""
|