From 0a7223674204a6e8ee311e226b2b5ddef88803a3 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Tue, 12 Feb 2013 16:08:59 +0000 Subject: Make sure edge bounds include decorations Fixes rendering of newly-drawn edges in GTK+ version. --- tikzit/src/common/Edge.m | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'tikzit/src/common/Edge.m') diff --git a/tikzit/src/common/Edge.m b/tikzit/src/common/Edge.m index 4ecb9bf..e90806d 100644 --- a/tikzit/src/common/Edge.m +++ b/tikzit/src/common/Edge.m @@ -522,7 +522,27 @@ - (NSRect)boundingRect { [self updateControls]; - return NSRectAround4Points(src, targ, cp1, cp2); + NSRect bound = NSRectAround4Points(head, tail, cp1, cp2); + if ([self style] != nil) { + switch ([[self style] decorationStyle]) { + case ED_Arrow: + bound = NSRectWithPoint(bound, [self midTan]); + case ED_Tick: + bound = NSRectWithPoint(bound, [self leftNormal]); + bound = NSRectWithPoint(bound, [self rightNormal]); + case ED_None: + break; + } + if ([[self style] headStyle] != AH_None) { + bound = NSRectWithPoint(bound, [self leftHeadNormal]); + bound = NSRectWithPoint(bound, [self rightHeadNormal]); + } + if ([[self style] tailStyle] != AH_None) { + bound = NSRectWithPoint(bound, [self leftTailNormal]); + bound = NSRectWithPoint(bound, [self rightTailNormal]); + } + } + return bound; } - (void) adjustWeight:(float)handle_dist withCourseness:(float)wcourseness { -- cgit v1.2.3