node-mac-recorder 2.22.23 → 2.22.24
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 +10 -61
- package/package.json +1 -1
|
@@ -105,39 +105,8 @@ function transformInputFrameGlobal(ifr, d) {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
// Electron: AX caret cache — deferred refresh ile crash-safe
|
|
109
|
-
const ELECTRON_AX_CACHE_MAX_AGE_MS = 500;
|
|
110
|
-
|
|
111
|
-
function deferredRefreshElectronAXCache(recorder, nativeBinding) {
|
|
112
|
-
if (recorder._axDeferredPending) return;
|
|
113
|
-
if (!nativeBinding || typeof nativeBinding.getTextInputSnapshot !== "function") return;
|
|
114
|
-
|
|
115
|
-
recorder._axDeferredPending = true;
|
|
116
|
-
setImmediate(() => {
|
|
117
|
-
recorder._axDeferredPending = false;
|
|
118
|
-
try {
|
|
119
|
-
const snap = nativeBinding.getTextInputSnapshot();
|
|
120
|
-
if (snap && Number.isFinite(snap.caretX) && Number.isFinite(snap.caretY)) {
|
|
121
|
-
const d = recorder.cursorDisplayInfo;
|
|
122
|
-
const caretT = transformGlobalToVideo(snap.caretX, snap.caretY, d);
|
|
123
|
-
recorder._axCaretCache = {
|
|
124
|
-
caretX: caretT.x,
|
|
125
|
-
caretY: caretT.y,
|
|
126
|
-
inputFrame: snap.inputFrame
|
|
127
|
-
? transformInputFrameGlobal(snap.inputFrame, d)
|
|
128
|
-
: null,
|
|
129
|
-
csys: d && d.videoRelative ? "video-relative" : "global",
|
|
130
|
-
wallMs: Date.now(),
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
} catch {
|
|
134
|
-
// AX API hata verirse mevcut cache'i koru
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
108
|
/** @returns {boolean} Dosyaya textInput satırı yazıldı mı */
|
|
140
|
-
function tryAppendSyntheticTextInputRow(recorder,
|
|
109
|
+
function tryAppendSyntheticTextInputRow(recorder, filepath, cursorData, timestamp) {
|
|
141
110
|
if (!IS_ELECTRON) {
|
|
142
111
|
return false;
|
|
143
112
|
}
|
|
@@ -153,8 +122,6 @@ function tryAppendSyntheticTextInputRow(recorder, nativeBinding, filepath, curso
|
|
|
153
122
|
wall - (recorder._electronSynthWallMs || 0) <
|
|
154
123
|
ELECTRON_SYNTH_THROTTLE_MS
|
|
155
124
|
) {
|
|
156
|
-
// Throttle aktif olsa bile AX cache yenilensin
|
|
157
|
-
deferredRefreshElectronAXCache(recorder, nativeBinding);
|
|
158
125
|
return false;
|
|
159
126
|
}
|
|
160
127
|
const vx = cursorData.x;
|
|
@@ -163,28 +130,6 @@ function tryAppendSyntheticTextInputRow(recorder, nativeBinding, filepath, curso
|
|
|
163
130
|
return false;
|
|
164
131
|
}
|
|
165
132
|
|
|
166
|
-
// Cached AX caret varsa gerçek caret pozisyonunu kullan
|
|
167
|
-
let caretX = vx;
|
|
168
|
-
let caretY = vy;
|
|
169
|
-
let inputFrame = { x: vx - 1, y: vy - 9, width: 2, height: 18 };
|
|
170
|
-
let coordinateSystem = cursorData.coordinateSystem;
|
|
171
|
-
|
|
172
|
-
const cache = recorder._axCaretCache;
|
|
173
|
-
if (
|
|
174
|
-
cache &&
|
|
175
|
-
Number.isFinite(cache.caretX) &&
|
|
176
|
-
Number.isFinite(cache.caretY) &&
|
|
177
|
-
(wall - (cache.wallMs || 0)) < ELECTRON_AX_CACHE_MAX_AGE_MS
|
|
178
|
-
) {
|
|
179
|
-
caretX = cache.caretX;
|
|
180
|
-
caretY = cache.caretY;
|
|
181
|
-
if (cache.inputFrame) inputFrame = cache.inputFrame;
|
|
182
|
-
coordinateSystem = cache.csys || coordinateSystem;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Sonraki frame için AX cache'i yenile (deferred — crash-safe)
|
|
186
|
-
deferredRefreshElectronAXCache(recorder, nativeBinding);
|
|
187
|
-
|
|
188
133
|
const tiRow = {
|
|
189
134
|
x: vx,
|
|
190
135
|
y: vy,
|
|
@@ -192,10 +137,15 @@ function tryAppendSyntheticTextInputRow(recorder, nativeBinding, filepath, curso
|
|
|
192
137
|
unixTimeMs: wall,
|
|
193
138
|
cursorType: "text",
|
|
194
139
|
type: "textInput",
|
|
195
|
-
caretX,
|
|
196
|
-
caretY,
|
|
197
|
-
inputFrame
|
|
198
|
-
|
|
140
|
+
caretX: vx,
|
|
141
|
+
caretY: vy,
|
|
142
|
+
inputFrame: {
|
|
143
|
+
x: vx - 1,
|
|
144
|
+
y: vy - 9,
|
|
145
|
+
width: 2,
|
|
146
|
+
height: 18,
|
|
147
|
+
},
|
|
148
|
+
coordinateSystem: cursorData.coordinateSystem,
|
|
199
149
|
recordingType: cursorData.recordingType,
|
|
200
150
|
videoInfo: cursorData.videoInfo || {},
|
|
201
151
|
displayInfo: cursorData.displayInfo || {},
|
|
@@ -567,7 +517,6 @@ async function startCursorCapture(recorder, nativeBinding, intervalOrFilepath, o
|
|
|
567
517
|
if (IS_ELECTRON) {
|
|
568
518
|
const textInputWritten = tryAppendSyntheticTextInputRow(
|
|
569
519
|
recorder,
|
|
570
|
-
nativeBinding,
|
|
571
520
|
filepath,
|
|
572
521
|
cursorData,
|
|
573
522
|
timestamp,
|