node-mac-recorder 1.14.2 → 1.16.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 +2 -1
- package/index.js +20 -2
- package/package.json +1 -1
- package/debug-cursor.js +0 -50
package/index.js
CHANGED
|
@@ -541,10 +541,27 @@ class MacRecorder extends EventEmitter {
|
|
|
541
541
|
// Koordinat sistemi belirle: window-relative, display-relative veya global
|
|
542
542
|
if (options.windowRelative && options.windowInfo) {
|
|
543
543
|
// Window-relative koordinatlar için pencere bilgilerini kullan
|
|
544
|
+
// Y koordinat dönüşümü - pencere kaydındaki gibi
|
|
545
|
+
const displays = await this.getDisplays();
|
|
546
|
+
const display = displays.find(d => d.id === options.windowInfo.displayId) || displays[0];
|
|
547
|
+
|
|
548
|
+
let adjustedX = options.windowInfo.x || 0;
|
|
549
|
+
let adjustedY = options.windowInfo.y || 0;
|
|
550
|
+
|
|
551
|
+
if (display) {
|
|
552
|
+
// Pencere koordinatlarını display-relative yapmak için display offset'ini çıkar
|
|
553
|
+
adjustedX = (options.windowInfo.x || 0) - display.x;
|
|
554
|
+
|
|
555
|
+
// Y koordinat dönüşümü: CGWindow (top-left) to AVFoundation (bottom-left)
|
|
556
|
+
const displayHeight = parseInt(display.resolution.split("x")[1]);
|
|
557
|
+
const convertedY = displayHeight - (options.windowInfo.y || 0) - options.windowInfo.height;
|
|
558
|
+
adjustedY = Math.max(0, convertedY - display.y);
|
|
559
|
+
}
|
|
560
|
+
|
|
544
561
|
this.cursorDisplayInfo = {
|
|
545
562
|
displayId: options.windowInfo.displayId || null,
|
|
546
|
-
x:
|
|
547
|
-
y:
|
|
563
|
+
x: adjustedX,
|
|
564
|
+
y: adjustedY,
|
|
548
565
|
width: options.windowInfo.width,
|
|
549
566
|
height: options.windowInfo.height,
|
|
550
567
|
windowRelative: true,
|
|
@@ -597,6 +614,7 @@ class MacRecorder extends EventEmitter {
|
|
|
597
614
|
|
|
598
615
|
if (this.cursorDisplayInfo) {
|
|
599
616
|
// Offset'leri çıkar (display veya window)
|
|
617
|
+
// Y koordinat dönüşümü başlangıçta yapıldı
|
|
600
618
|
x = position.x - this.cursorDisplayInfo.x;
|
|
601
619
|
y = position.y - this.cursorDisplayInfo.y;
|
|
602
620
|
|
package/package.json
CHANGED
package/debug-cursor.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
const MacRecorder = require('./index.js');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
|
|
4
|
-
// Create a minimal direct test
|
|
5
|
-
const recorder = new MacRecorder();
|
|
6
|
-
|
|
7
|
-
// Get current cursor position to test the new field
|
|
8
|
-
console.log('Testing cursor position API...');
|
|
9
|
-
const pos = recorder.getCursorPosition();
|
|
10
|
-
console.log('Current cursor position:', JSON.stringify(pos, null, 2));
|
|
11
|
-
|
|
12
|
-
// Test if we can start/stop cursor tracking
|
|
13
|
-
console.log('\nTesting cursor tracking start/stop...');
|
|
14
|
-
const testFile = 'debug-cursor-output.json';
|
|
15
|
-
|
|
16
|
-
// Remove existing file
|
|
17
|
-
if (fs.existsSync(testFile)) {
|
|
18
|
-
fs.unlinkSync(testFile);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const started = recorder.startCursorCapture(testFile);
|
|
22
|
-
console.log('Start result:', started);
|
|
23
|
-
|
|
24
|
-
if (started) {
|
|
25
|
-
// Wait 1 second and check what gets written
|
|
26
|
-
setTimeout(() => {
|
|
27
|
-
recorder.stopCursorCapture();
|
|
28
|
-
console.log('Stopped tracking');
|
|
29
|
-
|
|
30
|
-
// Check file content
|
|
31
|
-
if (fs.existsSync(testFile)) {
|
|
32
|
-
const content = fs.readFileSync(testFile, 'utf8');
|
|
33
|
-
console.log('\nFile content:');
|
|
34
|
-
console.log(content);
|
|
35
|
-
|
|
36
|
-
// Parse and pretty print
|
|
37
|
-
try {
|
|
38
|
-
const data = JSON.parse(content);
|
|
39
|
-
console.log('\nParsed data:');
|
|
40
|
-
console.log(JSON.stringify(data, null, 2));
|
|
41
|
-
} catch (e) {
|
|
42
|
-
console.log('Error parsing JSON:', e.message);
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
console.log('No output file created');
|
|
46
|
-
}
|
|
47
|
-
}, 1000);
|
|
48
|
-
} else {
|
|
49
|
-
console.log('Failed to start cursor tracking');
|
|
50
|
-
}
|