Keep tracking preview inside its frame and clear results when switching masks
这个提交包含在:
1 父节点
687a366e1c
当前提交
d2b6f8ef81
6 个文件已更改
+23
-9
没有与搜索条件相匹配的文件
@@ -39,6 +39,7 @@ static BOOL DYWorkspaceEnabled(DYUniforms u,NSString *type){if([type isEqual:@"b
|
||||
@interface DYColorWorkspace (Internal)
|
||||
- (void)layoutWorkspace;
|
||||
- (void)scopeChanged:(NSNotification *)notification;
|
||||
- (void)setTrackingPreviewVisible:(BOOL)visible;
|
||||
@end
|
||||
@interface DYWorkspaceLifetime:NSObject
|
||||
@property(nonatomic,assign) DYColorWorkspace *owner;
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
NSDictionary *_frame;
|
||||
NSImage *_image;
|
||||
}
|
||||
- (instancetype)initWithFrame:(NSRect)frame {
|
||||
if((self=[super initWithFrame:frame]))self.clipsToBounds=YES;
|
||||
return self;
|
||||
}
|
||||
- (BOOL)isFlipped {return YES;}
|
||||
- (BOOL)isAccessibilityElement {return YES;}
|
||||
- (NSString *)accessibilityRole {return NSAccessibilityImageRole;}
|
||||
@@ -50,7 +54,7 @@
|
||||
[(source?NSColor.systemCyanColor:NSColor.systemYellowColor) setStroke];path.lineWidth=1.6;[path stroke];
|
||||
}
|
||||
- (void)drawRect:(NSRect)dirty {
|
||||
[NSColor.blackColor setFill];NSRectFill(dirty);
|
||||
[NSColor.blackColor setFill];NSRectFill(NSIntersectionRect(dirty,self.bounds));
|
||||
if(!_image||NSIsEmptyRect(self.bounds))return;
|
||||
double aspect=[_frame[@"aspect"] doubleValue];
|
||||
if(!std::isfinite(aspect)||aspect<=0)aspect=_image.size.width/_image.size.height;
|
||||
@@ -75,6 +79,7 @@
|
||||
- (void)applyUpdate:(NSDictionary *)info;
|
||||
- (void)reset;
|
||||
@property(nonatomic,readonly) BOOL running;
|
||||
@property(nonatomic,readonly) NSString *maskID;
|
||||
@end
|
||||
|
||||
@implementation DYTrackingPreview {
|
||||
@@ -82,10 +87,13 @@
|
||||
NSTextField *_title,*_detail,*_status;
|
||||
NSButton *_action;
|
||||
NSProgressIndicator *_progress;
|
||||
NSString *_maskID;
|
||||
BOOL _running;
|
||||
}
|
||||
- (BOOL)isFlipped {return YES;}
|
||||
- (BOOL)running {return _running;}
|
||||
- (NSString *)maskID {return _maskID;}
|
||||
- (void)dealloc {[_maskID release];[super dealloc];}
|
||||
- (instancetype)initWithTarget:(id)target action:(SEL)action {
|
||||
if((self=[super initWithFrame:NSZeroRect])){
|
||||
self.identifier=@"DYTrackingPreview";
|
||||
@@ -112,6 +120,7 @@
|
||||
_detail.frame=NSMakeRect(8,MAX(80,h-22),body,18);
|
||||
}
|
||||
- (void)applyUpdate:(NSDictionary *)info {
|
||||
if(![_maskID isEqual:info[@"mask"]]){[_maskID release];_maskID=[info[@"mask"]copy];}
|
||||
BOOL active=[info[@"tracking"] boolValue];
|
||||
if(active&&!info[@"shape"]){[_preview showFrame:nil];_detail.stringValue=@"";_title.stringValue=@"跟踪预览";}
|
||||
if(info[@"shape"]){
|
||||
@@ -132,6 +141,6 @@
|
||||
_status.stringValue=info[@"message"]?:@"";_status.toolTip=_status.stringValue;
|
||||
}
|
||||
- (void)reset {
|
||||
[_progress stopAnimation:nil];_progress.indeterminate=NO;[_preview showFrame:nil];_running=NO;self.hidden=YES;
|
||||
[_progress stopAnimation:nil];_progress.indeterminate=NO;[_preview showFrame:nil];[_maskID release];_maskID=nil;_running=NO;self.hidden=YES;
|
||||
}
|
||||
@end
|
||||
@@ -43,7 +43,7 @@
|
||||
[trackingPreview layoutSubtreeIfNeeded];
|
||||
run.record(@"workspace-tracking-preview-replaces-scopes-with-readable-progress-and-image",
|
||||
!trackingPreview.hidden&&[(NSView *)plots.firstObject isHidden]&&progress.doubleValue==.5&&
|
||||
[image.accessibilityLabel containsString:@"0.080"]&&NSWidth(image.frame)>200&&NSHeight(image.frame)>120);
|
||||
[image.accessibilityLabel containsString:@"0.080"]&&image.clipsToBounds&&NSWidth(image.frame)>200&&NSHeight(image.frame)>120);
|
||||
__block BOOL cancelRouted=NO;
|
||||
id stopObserver=[trackingCenter addObserverForName:@"DYToolTrack" object:host queue:nil usingBlock:^(NSNotification *n){cancelRouted=[n.userInfo[@"direction"]intValue]==9;}];
|
||||
[previewAction performClick:nil];
|
||||
|
||||
@@ -142,7 +142,11 @@
|
||||
if(written)[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:host];else [self reportError:@"宿主未保存蒙版关联,原设置已保留"];
|
||||
}
|
||||
- (void)workspaceCanvasSelection:(NSNotification*)note {
|
||||
if(!_visible||_refreshingStack||![note.userInfo[@"mask"]length])return;NSString*mask=note.userInfo[@"mask"];if([mask isEqual:_selectedMask])return;[_selectedMask release];_selectedMask=[mask copy];if(![note.userInfo[@"node"]isEqual:@"shared"]){[_selectedNode release];_selectedNode=[note.userInfo[@"node"]copy];}_editorMode=1;[self rebuildWorkspaceEditor];
|
||||
if(!_visible||_refreshingStack||![note.userInfo[@"mask"]length])return;NSString*mask=note.userInfo[@"mask"];
|
||||
if(!_trackingPreview.hidden&&!_trackingPreview.running&&![_trackingPreview.maskID isEqual:mask]){
|
||||
[_trackingPreview reset];[self setTrackingPreviewVisible:NO];
|
||||
}
|
||||
if([mask isEqual:_selectedMask])return;[_selectedMask release];_selectedMask=[mask copy];if(![note.userInfo[@"node"]isEqual:@"shared"]){[_selectedNode release];_selectedNode=[note.userInfo[@"node"]copy];}_editorMode=1;[self rebuildWorkspaceEditor];
|
||||
}
|
||||
- (void)externalWorkspaceToolSelection:(NSNotification*)note {
|
||||
if(![note.userInfo[@"source"]isEqual:@"inspector"]||![note.userInfo[@"node"]length])return;_hasUserSelection=YES;[_selectedNode release];_selectedNode=[note.userInfo[@"node"]copy];[_selectedMask release];_selectedMask=nil;if(_visible){_editorMode=0;[self refreshToolWorkspace:nil];}
|
||||
|
||||
+3
-3
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.14.2</string>
|
||||
<string>1.14.3</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>92</string>
|
||||
<string>93</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>PlugInKit</key>
|
||||
@@ -71,7 +71,7 @@
|
||||
<key>uuid</key>
|
||||
<string>1C17B73B-F229-4C09-A434-EAF6DFF5F22A</string>
|
||||
<key>version</key>
|
||||
<string>1.14.2</string>
|
||||
<string>1.14.3</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>className</key>
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.14.2</string>
|
||||
<string>1.14.3</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>92</string>
|
||||
<string>93</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
在新工单中引用
屏蔽一个用户