@@ -2372,14 +2372,19 @@ def __call__(self, x0, y0, width, height, mutation_size):
2372
2372
class LArrow :
2373
2373
"""A box in the shape of a left-pointing arrow."""
2374
2374
2375
- def __init__ (self , pad = 0.3 ):
2375
+ def __init__ (self , pad = 0.3 , fhead = False ):
2376
2376
"""
2377
2377
Parameters
2378
2378
----------
2379
2379
pad : float, default: 0.3
2380
2380
The amount of padding around the original box.
2381
+
2382
+ fhead : bool, default: False
2383
+ If the arrowheads should be flush with the top
2384
+ and botton sides of the arrow body.
2381
2385
"""
2382
2386
self .pad = pad
2387
+ self .fhead = fhead
2383
2388
2384
2389
def __call__ (self , x0 , y0 , width , height , mutation_size ):
2385
2390
# padding
@@ -2394,11 +2399,17 @@ def __call__(self, x0, y0, width, height, mutation_size):
2394
2399
dxx = dx / 2
2395
2400
x0 = x0 + pad / 1.4 # adjust by ~sqrt(2)
2396
2401
2397
- return Path ._create_closed (
2398
- [(x0 + dxx , y0 ), (x1 , y0 ), (x1 , y1 ), (x0 + dxx , y1 ),
2399
- (x0 + dxx , y1 + dxx ), (x0 - dx , y0 + dx ),
2400
- (x0 + dxx , y0 - dxx ), # arrow
2401
- (x0 + dxx , y0 )])
2402
+ if self .fhead :
2403
+ return Path ._create_closed ([(x0 + dxx - pad , y0 ), (x1 , y0 ),
2404
+ (x1 , y1 ), (x0 + dxx - pad , y1 ),
2405
+ (x0 - dx - pad , y0 + dx ),
2406
+ (x0 + dxx - pad , y0 )])
2407
+
2408
+ return Path ._create_closed ([(x0 + dxx , y0 ), (x1 , y0 ), (x1 , y1 ),
2409
+ (x0 + dxx , y1 ), (x0 + dxx , y1 + dxx ),
2410
+ (x0 - dx , y0 + dx ),
2411
+ (x0 + dxx , y0 - dxx ), # arrow
2412
+ (x0 + dxx , y0 ), (x0 + dxx , y0 )])
2402
2413
2403
2414
@_register_style (_style_list )
2404
2415
class RArrow (LArrow ):
@@ -2415,14 +2426,19 @@ class DArrow:
2415
2426
"""A box in the shape of a two-way arrow."""
2416
2427
# Modified from LArrow to add a right arrow to the bbox.
2417
2428
2418
- def __init__ (self , pad = 0.3 ):
2429
+ def __init__ (self , pad = 0.3 , fhead = False ):
2419
2430
"""
2420
2431
Parameters
2421
2432
----------
2422
2433
pad : float, default: 0.3
2423
2434
The amount of padding around the original box.
2435
+
2436
+ fhead : bool, default: False
2437
+ If the arrowheads should be flush with the top
2438
+ and botton sides of the arrow body.
2424
2439
"""
2425
2440
self .pad = pad
2441
+ self .fhead = fhead
2426
2442
2427
2443
def __call__ (self , x0 , y0 , width , height , mutation_size ):
2428
2444
# padding
@@ -2438,14 +2454,24 @@ def __call__(self, x0, y0, width, height, mutation_size):
2438
2454
dxx = dx / 2
2439
2455
x0 = x0 + pad / 1.4 # adjust by ~sqrt(2)
2440
2456
2441
- return Path ._create_closed ([
2442
- (x0 + dxx , y0 ), (x1 , y0 ), # bot-segment
2443
- (x1 , y0 - dxx ), (x1 + dx + dxx , y0 + dx ),
2444
- (x1 , y1 + dxx ), # right-arrow
2445
- (x1 , y1 ), (x0 + dxx , y1 ), # top-segment
2446
- (x0 + dxx , y1 + dxx ), (x0 - dx , y0 + dx ),
2447
- (x0 + dxx , y0 - dxx ), # left-arrow
2448
- (x0 + dxx , y0 )])
2457
+ if self .fhead :
2458
+ return Path ._create_closed ([(x0 + dxx - pad , y0 ),
2459
+ (x1 + pad , y0 ),
2460
+ (x1 + dx + dxx + pad , y0 + dx ),
2461
+ (x1 + pad , y1 ),
2462
+ (x0 + dxx - pad , y1 ),
2463
+ (x0 - dx - pad , y0 + dx ),
2464
+ (x0 + dxx - pad , y0 )])
2465
+
2466
+ return Path ._create_closed ([(x0 + dxx , y0 ), (x1 , y0 ),
2467
+ (x1 , y0 - dxx ),
2468
+ (x1 + dx + dxx , y0 + dx ),
2469
+ (x1 , y1 + dxx ), # right-arrow
2470
+ (x1 , y1 ), (x0 + dxx , y1 ),
2471
+ (x0 + dxx , y1 + dxx ),
2472
+ (x0 - dx , y0 + dx ),
2473
+ (x0 + dxx , y0 - dxx ), # left-arrow
2474
+ (x0 + dxx , y0 )])
2449
2475
2450
2476
@_register_style (_style_list )
2451
2477
class Round :
0 commit comments