Make the clone source crosshair draggable without changing target tracks

这个提交包含在:
mac 于 2026-11-05 22:09:33 +08:00 提交
1 父节点 4fb008e100
当前提交 1f1b7917e7
6 个文件已更改
+61 -15

没有与搜索条件相匹配的文件

+10 -3
查看文件
@@ -36,8 +36,11 @@
- (NSRect)stampTarget{
return NSMakeRect(MIN(_stampStart.x,_stampEnd.x),MIN(_stampStart.y,_stampEnd.y),fabs(_stampStart.x-_stampEnd.x),fabs(_stampStart.y-_stampEnd.y));
}
- (NSPoint)canvasStampSource:(NSPoint)source{
return NSMakePoint(NSMinX(_imageRect)+source.x*NSWidth(_imageRect),NSMinY(_imageRect)+source.y*NSHeight(_imageRect));
}
- (void)drawStampSource:(NSPoint)source{
NSPoint p=NSMakePoint(NSMinX(_imageRect)+source.x*NSWidth(_imageRect),NSMinY(_imageRect)+source.y*NSHeight(_imageRect));
NSPoint p=[self canvasStampSource:source];
CGFloat r=8*_uiScale;
NSBezierPath *mark=[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(p.x-r,p.y-r,2*r,2*r)];
[mark moveToPoint:NSMakePoint(p.x-r,p.y)];[mark lineToPoint:NSMakePoint(p.x+r,p.y)];
@@ -110,9 +113,13 @@
if(drawing)for(NSInteger i=9;i<=10;i++)if(NSPointInRect(point,[self toolbarRectForItem:i]))return 10000+i;
NSInteger viewerHit=[_viewerControls partAtPoint:point];if(viewerHit)return viewerHit;
if(_viewerControls.stampArmed)return NSPointInRect(point,_imageRect)?10014:0;
if([_mask[@"stampSource"]count]==4){
NSInteger count=[_mask[@"tracking"]boolValue]?1:3;
NSArray *source=_mask[@"stampSource"];
if(source.count==4){
BOOL tracking=[_mask[@"tracking"]boolValue];
NSInteger count=tracking?1:3;
for(NSInteger i=0;i<count;i++)if(NSPointInRect(point,[self stampControlRect:i]))return 10011+i;
NSPoint cross=[self canvasStampSource:NSMakePoint([source[0]doubleValue],[source[1]doubleValue])];
if(!tracking&&NSPointInRect(point,_imageRect)&&hypot(cross.x-point.x,cross.y-point.y)<=12*_uiScale)return DYCloneSourcePart;
}
if(!_mask)return 0;if([_mask[@"drawShape"]boolValue])return NSPointInRect(point,_imageRect)?1:0;
DYMaskParameters p;[_mask[@"parameters"]getBytes:&p length:sizeof(p)];p.imageAspect=_imageRect.size.width/MAX(1.,_imageRect.size.height);