node-mac-recorder 2.22.20 → 2.22.21
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/lib/cursorCapture/polling.js +38 -10
- package/package.json +1 -1
|
@@ -106,7 +106,7 @@ function transformInputFrameGlobal(ifr, d) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/** @returns {boolean} Dosyaya textInput satırı yazıldı mı */
|
|
109
|
-
function tryAppendSyntheticTextInputRow(recorder, filepath, cursorData, timestamp) {
|
|
109
|
+
function tryAppendSyntheticTextInputRow(recorder, nativeBinding, filepath, cursorData, timestamp) {
|
|
110
110
|
if (!IS_ELECTRON) {
|
|
111
111
|
return false;
|
|
112
112
|
}
|
|
@@ -130,6 +130,36 @@ function tryAppendSyntheticTextInputRow(recorder, filepath, cursorData, timestam
|
|
|
130
130
|
return false;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
// Gerçek caret pozisyonunu accessibility API'den al
|
|
134
|
+
let caretX = vx;
|
|
135
|
+
let caretY = vy;
|
|
136
|
+
let inputFrame = { x: vx - 1, y: vy - 9, width: 2, height: 18 };
|
|
137
|
+
let hasRealCaret = false;
|
|
138
|
+
|
|
139
|
+
if (nativeBinding && typeof nativeBinding.getTextInputSnapshot === "function") {
|
|
140
|
+
try {
|
|
141
|
+
const snap = nativeBinding.getTextInputSnapshot();
|
|
142
|
+
if (
|
|
143
|
+
snap &&
|
|
144
|
+
Number.isFinite(snap.caretX) &&
|
|
145
|
+
Number.isFinite(snap.caretY)
|
|
146
|
+
) {
|
|
147
|
+
// Global koordinatları video uzayına dönüştür
|
|
148
|
+
const d = recorder.cursorDisplayInfo;
|
|
149
|
+
const caretT = transformGlobalToVideo(snap.caretX, snap.caretY, d);
|
|
150
|
+
caretX = caretT.x;
|
|
151
|
+
caretY = caretT.y;
|
|
152
|
+
hasRealCaret = true;
|
|
153
|
+
|
|
154
|
+
if (snap.inputFrame) {
|
|
155
|
+
inputFrame = transformInputFrameGlobal(snap.inputFrame, d);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
} catch {
|
|
159
|
+
// AX API hata verirse cursor pozisyonuna fallback
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
133
163
|
const tiRow = {
|
|
134
164
|
x: vx,
|
|
135
165
|
y: vy,
|
|
@@ -137,15 +167,12 @@ function tryAppendSyntheticTextInputRow(recorder, filepath, cursorData, timestam
|
|
|
137
167
|
unixTimeMs: wall,
|
|
138
168
|
cursorType: "text",
|
|
139
169
|
type: "textInput",
|
|
140
|
-
caretX
|
|
141
|
-
caretY
|
|
142
|
-
inputFrame
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
height: 18,
|
|
147
|
-
},
|
|
148
|
-
coordinateSystem: cursorData.coordinateSystem,
|
|
170
|
+
caretX,
|
|
171
|
+
caretY,
|
|
172
|
+
inputFrame,
|
|
173
|
+
coordinateSystem: hasRealCaret
|
|
174
|
+
? (recorder.cursorDisplayInfo?.videoRelative ? "video-relative" : "global")
|
|
175
|
+
: cursorData.coordinateSystem,
|
|
149
176
|
recordingType: cursorData.recordingType,
|
|
150
177
|
videoInfo: cursorData.videoInfo || {},
|
|
151
178
|
displayInfo: cursorData.displayInfo || {},
|
|
@@ -517,6 +544,7 @@ async function startCursorCapture(recorder, nativeBinding, intervalOrFilepath, o
|
|
|
517
544
|
if (IS_ELECTRON) {
|
|
518
545
|
const textInputWritten = tryAppendSyntheticTextInputRow(
|
|
519
546
|
recorder,
|
|
547
|
+
nativeBinding,
|
|
520
548
|
filepath,
|
|
521
549
|
cursorData,
|
|
522
550
|
timestamp,
|