diff options
author | Alex Merry <alex.merry@cs.ox.ac.uk> | 2013-02-12 16:08:59 +0000 |
---|---|---|
committer | Alex Merry <alex.merry@cs.ox.ac.uk> | 2013-02-12 16:21:47 +0000 |
commit | 0a7223674204a6e8ee311e226b2b5ddef88803a3 (patch) | |
tree | 0c93ec903531c5b2eee065ca36e621ecd782610a /tikzit/src/common/Edge.m | |
parent | 904fa7d389b98a3ce7735f2979652be43f28ee2a (diff) |
Make sure edge bounds include decorations
Fixes rendering of newly-drawn edges in GTK+ version.
Diffstat (limited to 'tikzit/src/common/Edge.m')
-rw-r--r-- | tikzit/src/common/Edge.m | 22 |
1 files changed, 21 insertions, 1 deletions
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 { |