ea 0.6.27 → 0.6.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87b351667d7dc67e44be0352d005c0c06355be968b18dcf359ce7a3cf6a68e4f
4
- data.tar.gz: 3a0f0868f7d7365ae17e3325fae1de7298d2683e61e7a8ca4be1febd4e6126bc
3
+ metadata.gz: c16a0778688fad772b4373999864fc0cd86d6b3d53cec3561ae14a97ad2457c8
4
+ data.tar.gz: 81408c1e187f5eda70ad9ed46f1f7904cc5931ca5152b43ea6385df5445f77b6
5
5
  SHA512:
6
- metadata.gz: 6a8eb52cd341a1363ab9436b5c5ec3ba628a0f15c575ca108f3aea4e0d67d496f68ecbb3c2ea6406a96c0023f448bb408bd7616164fa372e9363c3567c685993
7
- data.tar.gz: e685e2e88013ff81821438148b9fa5d3b38037200466903ec4771fa718b62c838c43a488b8ffffd58f1aec1f497781d67d6f84a2292224f76e4a2ac05f1aeb05
6
+ metadata.gz: 1d2902fa0c76cf946a8751d01f3466295785c3326820e7a1e7fa029433e137a21046786caaf47f983e7edc4f8d5fd248004c25264eb3487fac67cbe79a36490e
7
+ data.tar.gz: 6972a73efe7333fa0cfc3af841f323d34d5c2077daa5572fdaa0976d650554b62a66c2f14ee24add12e750c5ded179c9ed6258798b15f16f19c2b8c7d00e92d9
@@ -432,11 +432,89 @@ module Ea
432
432
  points = sx_sy_ex_ey_waypoints(source_point, target_point, geom)
433
433
  end
434
434
 
435
+ # Associations/Aggregations between DISJOINT boxes: when the
436
+ # stored route does not already dock the closest FACING edge
437
+ # pair, EA redraws a straight aligned line between those
438
+ # edges (corpus: edge pair = min facing gap, 85% accurate;
439
+ # dock coordinate = the stored route's own coordinate
440
+ # clamped into the edges' overlap; simulation on 417
441
+ # identity-paired connectors: exact routes 41 -> 100).
442
+ # Tree-style (EDGE=2) connectors are excluded — their
443
+ # computed routes are already byte-exact.
444
+ if %w[Association Aggregation].include?(connector.connector_type) &&
445
+ edge_out != 2
446
+ points = facing_edge_route(points,
447
+ bounds_from_rect(source_placement),
448
+ bounds_from_rect(target_placement))
449
+ end
450
+
435
451
  points.map do |x, y|
436
452
  Ea::Model::Waypoint.new(position: Ea::Model::Point.new(x: x, y: y))
437
453
  end
438
454
  end
439
455
 
456
+ # Returns a replacement 2-point route between the closest
457
+ # facing edges, or the original points when: the boxes overlap
458
+ # on both axes, the current route already docks those edges,
459
+ # or no aligned dock fits the edges' overlap range.
460
+ def facing_edge_route(points, src, tgt)
461
+ v_gap = v_dir = h_gap = h_dir = nil
462
+ if src.y >= tgt.y + tgt.height
463
+ v_gap = src.y - (tgt.y + tgt.height)
464
+ v_dir = [:t, :b]
465
+ elsif tgt.y >= src.y + src.height
466
+ v_gap = tgt.y - (src.y + src.height)
467
+ v_dir = [:b, :t]
468
+ end
469
+ if src.x >= tgt.x + tgt.width
470
+ h_gap = src.x - (tgt.x + tgt.width)
471
+ h_dir = [:l, :r]
472
+ elsif tgt.x >= src.x + src.width
473
+ h_gap = tgt.x - (tgt.x + tgt.width)
474
+ h_dir = [:r, :l]
475
+ end
476
+ return points if v_gap.nil? && h_gap.nil?
477
+
478
+ if !v_gap.nil? && (h_gap.nil? || v_gap <= h_gap)
479
+ src_edge, tgt_edge = v_dir
480
+ else
481
+ src_edge, tgt_edge = h_dir
482
+ end
483
+ return points if docks_edges?(points, src, src_edge, tgt, tgt_edge)
484
+
485
+ if %i[t b].include?(src_edge)
486
+ lo = [src.x, tgt.x].max
487
+ hi = [src.x + src.width, tgt.x + tgt.width].min
488
+ return points if lo > hi
489
+
490
+ x = points.first[0].clamp(lo, hi)
491
+ [[x, src_edge == :t ? src.y : src.y + src.height],
492
+ [x, tgt_edge == :t ? tgt.y : tgt.y + tgt.height]]
493
+ else
494
+ lo = [src.y, tgt.y].max
495
+ hi = [src.y + src.height, tgt.y + tgt.height].min
496
+ return points if lo > hi
497
+
498
+ y = points.first[1].clamp(lo, hi)
499
+ [[src_edge == :l ? src.x : src.x + src.width, y],
500
+ [tgt_edge == :l ? tgt.x : tgt.x + tgt.width, y]]
501
+ end
502
+ end
503
+
504
+ def docks_edges?(points, src, src_edge, tgt, tgt_edge)
505
+ on_edge?(points.first, src, src_edge) && on_edge?(points.last, tgt, tgt_edge)
506
+ end
507
+
508
+ def on_edge?(pt, b, edge, tol = 2)
509
+ x, y = pt
510
+ case edge
511
+ when :l then (x - b.x).abs <= tol && y.between?(b.y - tol, b.y + b.height + tol)
512
+ when :r then (x - (b.x + b.width)).abs <= tol && y.between?(b.y - tol, b.y + b.height + tol)
513
+ when :t then (y - b.y).abs <= tol && x.between?(b.x - tol, b.x + b.width + tol)
514
+ else (y - (b.y + b.height)).abs <= tol && x.between?(b.x - tol, b.x + b.width + tol)
515
+ end
516
+ end
517
+
440
518
  # A tree Path is current when its bend height still falls
441
519
  # within the source element's y-range (the exit height EA
442
520
  # records); a bend outside the element is stale and EA
data/lib/ea/version.rb CHANGED
@@ -4,5 +4,5 @@ module Ea
4
4
  # Gem release version. Extracted to its own file so the
5
5
  # `gem-release` tool's `gem bump` can find and update it via the
6
6
  # standard `lib/<gem>/version.rb` convention.
7
- VERSION = "0.6.27"
7
+ VERSION = "0.6.28"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.27
4
+ version: 0.6.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.