node-mac-recorder 2.20.15 → 2.20.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.20.15",
3
+ "version": "2.20.16",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -58,7 +58,10 @@ static NSInteger g_currentActiveScreenIndex = -1;
58
58
 
59
59
  // Record icon helpers
60
60
  static NSImage *CreateRecordIconImage(CGFloat size) {
61
- NSImage *image = [[[NSImage alloc] initWithSize:NSMakeSize(size, size)] autorelease];
61
+ const CGFloat leadingInset = 8.0;
62
+ const CGFloat trailingSpacing = 6.0;
63
+ CGFloat width = leadingInset + size + trailingSpacing;
64
+ NSImage *image = [[[NSImage alloc] initWithSize:NSMakeSize(width, size)] autorelease];
62
65
  if (!image) {
63
66
  return nil;
64
67
  }
@@ -66,21 +69,22 @@ static NSImage *CreateRecordIconImage(CGFloat size) {
66
69
  [image lockFocus];
67
70
 
68
71
  [[NSColor clearColor] setFill];
69
- NSRectFill(NSMakeRect(0, 0, size, size));
72
+ NSRectFill(NSMakeRect(0, 0, width, size));
70
73
 
71
74
  CGFloat strokeWidth = MAX(2.0, size * 0.12);
72
- NSRect outerRect = NSMakeRect(strokeWidth / 2.0,
73
- strokeWidth / 2.0,
74
- size - strokeWidth,
75
- size - strokeWidth);
75
+ NSRect iconRect = NSMakeRect(leadingInset,
76
+ (size - size) / 2.0,
77
+ size,
78
+ size);
79
+ NSRect outerRect = NSInsetRect(iconRect, strokeWidth / 2.0, strokeWidth / 2.0);
76
80
  NSBezierPath *outerPath = [NSBezierPath bezierPathWithOvalInRect:outerRect];
77
81
  [outerPath setLineWidth:strokeWidth];
78
82
  [[NSColor whiteColor] setStroke];
79
83
  [outerPath stroke];
80
84
 
81
85
  CGFloat innerDiameter = size * 0.45;
82
- NSRect innerRect = NSMakeRect((size - innerDiameter) / 2.0,
83
- (size - innerDiameter) / 2.0,
86
+ NSRect innerRect = NSMakeRect(NSMidX(iconRect) - innerDiameter / 2.0,
87
+ NSMidY(iconRect) - innerDiameter / 2.0,
84
88
  innerDiameter,
85
89
  innerDiameter);
86
90
  NSBezierPath *innerPath = [NSBezierPath bezierPathWithOvalInRect:innerRect];
@@ -115,6 +119,11 @@ static void ApplyStartRecordButtonIcon(NSButton *button) {
115
119
  [button setImageScaling:NSImageScaleNone];
116
120
  [button setImagePosition:NSImageLeft];
117
121
 
122
+ if ([button respondsToSelector:@selector(setContentInsets:)]) {
123
+ NSEdgeInsets insets = NSEdgeInsetsMake(0, 12.0, 0, 12.0);
124
+ [button setContentInsets:insets];
125
+ }
126
+
118
127
  if ([button respondsToSelector:@selector(setContentTintColor:)]) {
119
128
  [button setContentTintColor:[NSColor whiteColor]];
120
129
  }