|
11 | 11 | #import "AppDelegate.h" |
12 | 12 | #import "DragView.h" |
13 | 13 |
|
14 | | -static NSImage *MaskImage(NSScreen *screen, CGSize size, CGFloat cornerRadius) |
| 14 | +static NSImage *MaskImage(NSScreen *screen, CGSize size, CGFloat cornerRadius, CGFloat white) |
15 | 15 | { |
16 | 16 | CGFloat scale = screen.backingScaleFactor; |
17 | 17 |
|
|
32 | 32 | NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithBitmapImageRep:rep]; |
33 | 33 | [NSGraphicsContext setCurrentContext:context]; |
34 | 34 |
|
35 | | - [[NSColor blackColor] set]; |
| 35 | + [[NSColor colorWithWhite:white alpha:1.0] set]; |
36 | 36 | [[NSBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size.width * scale, size.height * scale) |
37 | 37 | xRadius:cornerRadius |
38 | 38 | yRadius:cornerRadius] fill]; |
@@ -97,23 +97,24 @@ -(void)applicationDidFinishLaunching:(NSNotification *)notification |
97 | 97 | CGRect viewFrame = { .origin = CGPointZero, .size = windowSize }; |
98 | 98 |
|
99 | 99 | // create visual effect view as the root container |
100 | | - NSVisualEffectView *effectView = [[NSVisualEffectView alloc] initWithFrame:viewFrame]; |
101 | | - effectView.blendingMode = NSVisualEffectBlendingModeBehindWindow; |
102 | | - effectView.material = NSVisualEffectMaterialDark; |
103 | | - effectView.maskImage = MaskImage(ScreenForPoint(mouseLocation), windowSize, 10); |
104 | | - _window.contentView = effectView; |
| 100 | + NSImageView *view = [[NSImageView alloc] initWithFrame:viewFrame]; |
| 101 | + NSScreen *screen = ScreenForPoint(mouseLocation); |
| 102 | + view.image = MaskImage(screen, windowSize, 10, 0.2); |
| 103 | + _window.contentView = view; |
105 | 104 |
|
106 | 105 | // add drag view |
107 | 106 | _dragView = [[DragView alloc] initWithFrame:viewFrame]; |
108 | 107 | _dragView.fileURLs = _fileURLs; |
109 | | - [effectView addSubview:_dragView]; |
| 108 | + [view addSubview:_dragView]; |
110 | 109 |
|
111 | 110 | [_window makeKeyAndOrderFront:nil]; |
112 | 111 |
|
113 | 112 | // drag view behavior |
114 | 113 | __weak typeof(self) weakSelf = self; |
115 | 114 |
|
116 | 115 | _dragView.startDrag = ^(NSEvent *event) { |
| 116 | + view.image = MaskImage(screen, windowSize, 10, 0.05); |
| 117 | + |
117 | 118 | NSMutableArray *items = [NSMutableArray arrayWithCapacity:weakSelf.fileURLs.count]; |
118 | 119 |
|
119 | 120 | for (NSURL *URL in weakSelf.fileURLs) |
|
0 commit comments