diff options
-rw-r--r-- | tikzit/src/common/Edge.m | 22 | ||||
-rw-r--r-- | tikzit/src/gtk/Edge+Render.m | 8 |
2 files changed, 15 insertions, 15 deletions
diff --git a/tikzit/src/common/Edge.m b/tikzit/src/common/Edge.m index d95d528..9e983d5 100644 --- a/tikzit/src/common/Edge.m +++ b/tikzit/src/common/Edge.m @@ -93,10 +93,10 @@ NSPoint intersect; [curve updateControls]; if (lineSegmentIntersectsBezier (rayStart, rayEnd, - [shapeTrans toScreen:curve->head], + [shapeTrans toScreen:curve->tail], [shapeTrans toScreen:curve->cp1], [shapeTrans toScreen:curve->cp2], - [shapeTrans toScreen:curve->tail], + [shapeTrans toScreen:curve->head], &intersect)) { // we just keep shortening the line rayStart = intersect; @@ -108,10 +108,10 @@ } - (NSPoint) _findTanFor:(NSPoint)pt usingSpanFrom:(float)t1 to:(float)t2 { - float dx = bezierInterpolate(t2, head.x, cp1.x, cp2.x, tail.x) - - bezierInterpolate(t1, head.x, cp1.x, cp2.x, tail.x); - float dy = bezierInterpolate(t2, head.y, cp1.y, cp2.y, tail.y) - - bezierInterpolate(t1, head.y, cp1.y, cp2.y, tail.y); + float dx = bezierInterpolate(t2, tail.x, cp1.x, cp2.x, head.x) - + bezierInterpolate(t1, tail.x, cp1.x, cp2.x, head.x); + float dy = bezierInterpolate(t2, tail.y, cp1.y, cp2.y, head.y) - + bezierInterpolate(t1, tail.y, cp1.y, cp2.y, head.y); // normalise float len = sqrt(dx*dx+dy*dy); @@ -151,8 +151,8 @@ angleTarg = (float)inAngle * (M_PI / 180.0f); } - head = [self _findContactPointOn:source at:angleSrc]; - tail = [self _findContactPointOn:target at:angleTarg]; + tail = [self _findContactPointOn:source at:angleSrc]; + head = [self _findContactPointOn:target at:angleTarg]; // give a default distance for self-loops float cdist = (dx==0.0f && dy==0.0f) ? weight : sqrt(dx*dx + dy*dy) * weight; @@ -163,11 +163,11 @@ cp2 = NSMakePoint(targ.x + (cdist * cos(angleTarg)), targ.y + (cdist * sin(angleTarg))); - mid = bezierInterpolateFull (0.5f, head, cp1, cp2, tail); + mid = bezierInterpolateFull (0.5f, tail, cp1, cp2, head); midTan = [self _findTanFor:mid usingSpanFrom:0.4f to:0.6f]; - headTan = [self _findTanFor:head usingSpanFrom:0.0f to:0.1f]; - tailTan = [self _findTanFor:tail usingSpanFrom:1.0f to:0.9f]; + tailTan = [self _findTanFor:tail usingSpanFrom:0.0f to:0.1f]; + headTan = [self _findTanFor:head usingSpanFrom:1.0f to:0.9f]; } dirty = NO; } diff --git a/tikzit/src/gtk/Edge+Render.m b/tikzit/src/gtk/Edge+Render.m index d4a49c9..2c89b48 100644 --- a/tikzit/src/gtk/Edge+Render.m +++ b/tikzit/src/gtk/Edge+Render.m @@ -162,14 +162,14 @@ static const float cpLineWidth = 1.0; } - (void) createStrokePathInContext:(id<RenderContext>)context withTransformer:(Transformer*)transformer { - NSPoint c_head = [transformer toScreen:head]; + NSPoint c_tail = [transformer toScreen:tail]; NSPoint c_cp1 = [transformer toScreen:cp1]; NSPoint c_cp2 = [transformer toScreen:cp2]; - NSPoint c_tail = [transformer toScreen:tail]; + NSPoint c_head = [transformer toScreen:head]; [context startPath]; - [context moveTo:c_head]; - [context curveTo:c_tail withCp1:c_cp1 andCp2:c_cp2]; + [context moveTo:c_tail]; + [context curveTo:c_head withCp1:c_cp1 andCp2:c_cp2]; if ([self style] != nil) { // draw edge decoration |