node-mac-recorder 2.18.4 → 2.18.6
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/index.js +37 -20
- package/package.json +1 -1
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"Bash(timeout:*)",
|
|
11
11
|
"Bash(grep:*)",
|
|
12
12
|
"Bash(./test-cleanup.sh:*)",
|
|
13
|
-
"Bash(FORCE_AVFOUNDATION=1 node test-avfoundation-dpr.js)"
|
|
13
|
+
"Bash(FORCE_AVFOUNDATION=1 node test-avfoundation-dpr.js)",
|
|
14
|
+
"Bash(FORCE_AVFOUNDATION=1 node test-cursor-fix.js)",
|
|
15
|
+
"Bash(pkill:*)"
|
|
14
16
|
],
|
|
15
17
|
"deny": [],
|
|
16
18
|
"ask": []
|
package/index.js
CHANGED
|
@@ -705,6 +705,8 @@ class MacRecorder extends EventEmitter {
|
|
|
705
705
|
// Calculate video offset based on recording type
|
|
706
706
|
let videoOffsetX = 0;
|
|
707
707
|
let videoOffsetY = 0;
|
|
708
|
+
// UNIFIED CURSOR SYSTEM: Always use logical dimensions for cursor coordinates
|
|
709
|
+
// This ensures cursor tracking works consistently across all recording engines
|
|
708
710
|
let videoWidth = options.displayInfo.width || options.displayInfo.logicalWidth;
|
|
709
711
|
let videoHeight = options.displayInfo.height || options.displayInfo.logicalHeight;
|
|
710
712
|
|
|
@@ -739,6 +741,11 @@ class MacRecorder extends EventEmitter {
|
|
|
739
741
|
videoOffsetY: videoOffsetY,
|
|
740
742
|
videoWidth: videoWidth,
|
|
741
743
|
videoHeight: videoHeight,
|
|
744
|
+
// CRITICAL: Video output size for proper cursor scaling
|
|
745
|
+
videoOutputWidth: (options.displayInfo.scaleFactor > 1.0) ?
|
|
746
|
+
(options.displayInfo.physicalWidth || videoWidth) : videoWidth,
|
|
747
|
+
videoOutputHeight: (options.displayInfo.scaleFactor > 1.0) ?
|
|
748
|
+
(options.displayInfo.physicalHeight || videoHeight) : videoHeight,
|
|
742
749
|
videoRelative: true,
|
|
743
750
|
recordingType: options.recordingType || 'display',
|
|
744
751
|
// Store additional context for debugging
|
|
@@ -759,8 +766,16 @@ class MacRecorder extends EventEmitter {
|
|
|
759
766
|
scaleFactor: this.recordingDisplayInfo.scaleFactor || 1.0,
|
|
760
767
|
videoOffsetX: 0,
|
|
761
768
|
videoOffsetY: 0,
|
|
769
|
+
// UNIFIED CURSOR SYSTEM: Always use logical dimensions
|
|
762
770
|
videoWidth: this.recordingDisplayInfo.width || this.recordingDisplayInfo.logicalWidth,
|
|
763
771
|
videoHeight: this.recordingDisplayInfo.height || this.recordingDisplayInfo.logicalHeight,
|
|
772
|
+
// CRITICAL: Video output size for proper cursor scaling
|
|
773
|
+
videoOutputWidth: (this.recordingDisplayInfo.scaleFactor > 1.0) ?
|
|
774
|
+
(this.recordingDisplayInfo.physicalWidth || this.recordingDisplayInfo.width || this.recordingDisplayInfo.logicalWidth) :
|
|
775
|
+
(this.recordingDisplayInfo.width || this.recordingDisplayInfo.logicalWidth),
|
|
776
|
+
videoOutputHeight: (this.recordingDisplayInfo.scaleFactor > 1.0) ?
|
|
777
|
+
(this.recordingDisplayInfo.physicalHeight || this.recordingDisplayInfo.height || this.recordingDisplayInfo.logicalHeight) :
|
|
778
|
+
(this.recordingDisplayInfo.height || this.recordingDisplayInfo.logicalHeight),
|
|
764
779
|
videoRelative: true,
|
|
765
780
|
recordingType: options.recordingType || 'display'
|
|
766
781
|
};
|
|
@@ -812,28 +827,30 @@ class MacRecorder extends EventEmitter {
|
|
|
812
827
|
const displayRelativeX = position.x - this.cursorDisplayInfo.displayX;
|
|
813
828
|
const displayRelativeY = position.y - this.cursorDisplayInfo.displayY;
|
|
814
829
|
|
|
815
|
-
// CRITICAL FIX: Apply physical scaling for AVFoundation recording
|
|
816
|
-
// AVFoundation records at physical resolution while cursor coordinates are logical
|
|
817
|
-
let scaledX = displayRelativeX;
|
|
818
|
-
let scaledY = displayRelativeY;
|
|
819
|
-
|
|
820
|
-
if (this.cursorDisplayInfo.scaleFactor && this.cursorDisplayInfo.scaleFactor > 1.0) {
|
|
821
|
-
// Scale logical cursor coordinates to match physical video dimensions
|
|
822
|
-
scaledX = displayRelativeX * this.cursorDisplayInfo.scaleFactor;
|
|
823
|
-
scaledY = displayRelativeY * this.cursorDisplayInfo.scaleFactor;
|
|
824
|
-
coordinateSystem = "video-relative-scaled";
|
|
825
|
-
}
|
|
826
|
-
|
|
827
830
|
// Step 2: Transform display-relative → video-relative coordinates
|
|
828
|
-
x =
|
|
829
|
-
y =
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
831
|
+
x = displayRelativeX - this.cursorDisplayInfo.videoOffsetX;
|
|
832
|
+
y = displayRelativeY - this.cursorDisplayInfo.videoOffsetY;
|
|
833
|
+
|
|
834
|
+
// Step 3: Scale to match actual video output size (for AVFoundation physical scaling)
|
|
835
|
+
if (this.cursorDisplayInfo.videoOutputWidth && this.cursorDisplayInfo.videoOutputHeight) {
|
|
836
|
+
const scaleX = this.cursorDisplayInfo.videoOutputWidth / this.cursorDisplayInfo.videoWidth;
|
|
837
|
+
const scaleY = this.cursorDisplayInfo.videoOutputHeight / this.cursorDisplayInfo.videoHeight;
|
|
838
|
+
|
|
839
|
+
if (scaleX !== 1.0 || scaleY !== 1.0) {
|
|
840
|
+
x = x * scaleX;
|
|
841
|
+
y = y * scaleY;
|
|
842
|
+
coordinateSystem = "video-output-scaled";
|
|
843
|
+
} else {
|
|
844
|
+
coordinateSystem = "video-relative";
|
|
845
|
+
}
|
|
846
|
+
} else {
|
|
847
|
+
coordinateSystem = "video-relative";
|
|
848
|
+
}
|
|
835
849
|
|
|
836
|
-
|
|
850
|
+
// Bounds check for video area using actual video output dimensions
|
|
851
|
+
const checkWidth = this.cursorDisplayInfo.videoOutputWidth || this.cursorDisplayInfo.videoWidth;
|
|
852
|
+
const checkHeight = this.cursorDisplayInfo.videoOutputHeight || this.cursorDisplayInfo.videoHeight;
|
|
853
|
+
const outsideVideo = x < 0 || y < 0 || x >= checkWidth || y >= checkHeight;
|
|
837
854
|
|
|
838
855
|
// For debugging - add metadata if cursor is outside video area
|
|
839
856
|
if (outsideVideo) {
|