ea 0.6.92 → 0.6.93

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: 641441bf5b181aaadd045223f47a59069d916f48247f19ab4e6bc6c19cfeee03
4
- data.tar.gz: 0eb407d782f28301f0747a2f251ce3412f97cc60882f87cc7062567d1e7e4a64
3
+ metadata.gz: ffc412a948388b91fc07382b857fdcdbb4fda6a6d12bdc4cba7931c29720bf2e
4
+ data.tar.gz: 06cf5da1fb2062d414866f36e03798cfc9052fb2fcae45dfb78552e754d07662
5
5
  SHA512:
6
- metadata.gz: d705861a5209c8646e01fb097b4329e634744bdeef07355d00598a45bff1134ab186c69c0088250a3a3c5ece15d2c39281653c0e667a473fea80dbfd4bb9b9c0
7
- data.tar.gz: 84fce6fa28c77169812dda317ef720035c1ac9b17ac854238aa376480980308b7c506e6f3fa52e23807e7cc851546fe65b0c6b8bda72b937b1d9a99ab82953ad
6
+ metadata.gz: 3d498df6109da7ad7c4368b589f34c9dbe3a48171571e9993fef75d80874e3f1eb6a31e6f890db39c5f413a61e895da8e3bf7f81a6d01b94fdc0a225267fb809
7
+ data.tar.gz: ec4537e30476a83f7ecc39c29aacb1d54f6a788f9a87c97bfcf86f665ece6010ca640a31062d30c0ad2f1fa8362bc1e834f207355989b27f9197ede225eff54a
@@ -8,6 +8,21 @@ module Ea
8
8
  module Routing
9
9
  private
10
10
 
11
+ # A lateral tree leaves the side edge before turning upward.
12
+ # Keep that dock only when its first leg actually points outward.
13
+ def lateral_source_exit?(points, link_row, bounds)
14
+ return false unless points.size == 3 && DiagramStyleParser.parse(link_row.style)[:tree] == "LV"
15
+
16
+ anchor, bend = points.take(2)
17
+ anchor[1] == bend[1] && outward_side_exit?(anchor[0], bend[0], bounds)
18
+ end
19
+
20
+ def outward_side_exit?(anchor_x, bend_x, bounds)
21
+ left = bounds.x
22
+ right = left + bounds.width
23
+ (anchor_x == left && bend_x < left) || (anchor_x == right && bend_x > right)
24
+ end
25
+
11
26
  # Keep a vertical tree trunk whose bends still fit both boxes
12
27
  # and the open gap; the closest facing edges need not share its x.
13
28
  def preserve_stored_tree?(points, link_row, connector, src, tgt)
@@ -577,9 +577,8 @@ module Ea
577
577
  # describe the source-side and target-side bend offsets
578
578
  # relative to the edge attachment points.
579
579
  #
580
- # Path takes precedence when present — it's the authoritative
581
- # routing. SX/SY/EX/EY are fallback for auto-routed direct
582
- # connectors with at most one bend on each end.
580
+ # Custom-line Path takes precedence when present. Direct mode
581
+ # ignores old custom bends; SX/SY/EX/EY supply its endpoint ports.
583
582
  #
584
583
  # If we can't resolve the source or target element placement
585
584
  # for this diagram, we emit no waypoints (the connector will
@@ -607,8 +606,10 @@ module Ea
607
606
  element_edge_point(target_placement, :target, edge_out)
608
607
 
609
608
  intermediate = intermediate_waypoints(link_row)
610
- if edge_out == 2 && source_port && target_port &&
611
- !valid_tree_path?(intermediate, source_placement)
609
+ if DiagramStyleParser.parse(link_row.style)[:mode] == "1"
610
+ points = [source_point, target_point]
611
+ elsif edge_out == 2 && source_port && target_port &&
612
+ !valid_tree_path?(intermediate, source_placement)
612
613
  # A stale tree Path (not on the source's facing edge) is
613
614
  # recomputed: source port -> corner at (target dock x,
614
615
  # source exit y) -> target port.
@@ -923,7 +924,7 @@ module Ea
923
924
  target_y = tgt_b.y + tgt_b.height
924
925
  source_y -= inset if points[1][1] < source_y - inset
925
926
  target_y += inset if points[-2][1] > target_y + inset
926
- unless strict && points[1][1] >= source_y
927
+ unless lateral_source_exit?(points, link_row, src_b) || (strict && points[1][1] >= source_y)
927
928
  points[0] = [points[1][0].clamp(src_b.x, src_b.x + src_b.width), source_y]
928
929
  end
929
930
  unless strict && points[-2][1] <= target_y
@@ -44,12 +44,22 @@ module Ea
44
44
  # connector - the DiagramConnector (for relationship lookup)
45
45
  # end_kind - :source or :target
46
46
  # heading - [dx, dy] of the first leg leaving the anchor
47
+ # stored_labels - the connector has stored label boxes at
48
+ # either end; false keeps the opposite-end
49
+ # fallback
47
50
  def texts(text_box:, mult_box:, anchor:, connector:, end_kind:,
48
- tree: false, heading: nil)
51
+ tree: false, heading: nil, stored_labels: false)
49
52
  from_property, role, mult = role_and_multiplicity(connector, end_kind)
50
53
  if role_empty?(role) && mult_empty?(mult)
51
54
  other_from_prop, other_role, other_mult = role_and_multiplicity(connector,
52
55
  opposite(end_kind))
56
+ if stored_labels
57
+ return [] if role_empty?(other_role) && mult_empty?(other_mult)
58
+
59
+ return own_stereotype_only(text_box, anchor, connector,
60
+ end_kind)
61
+ end
62
+
53
63
  role = other_role if role_empty?(role)
54
64
  mult ||= other_mult
55
65
  from_property ||= other_from_prop
@@ -88,6 +98,19 @@ module Ea
88
98
 
89
99
  private
90
100
 
101
+ # With stored boxes on the connector, an end that carries no
102
+ # data of its own draws only its own stereotype; the data end
103
+ # draws the role and multiplicity; with no data anywhere nothing
104
+ # is drawn. Connectors with no stored box keep the opposite-end
105
+ # fallback.
106
+ def own_stereotype_only(text_box, anchor, connector, end_kind)
107
+ stereo = connector_source_dest_stereotype(connector, end_kind)
108
+ pos = position_at(text_box, anchor)
109
+ return [] if stereo.nil? || stereo.empty? || pos.nil?
110
+
111
+ [text_at(pos[0], pos[1], "«#{stereo}»")]
112
+ end
113
+
91
114
  # EA's tree-route label clusters (hand-verified against the
92
115
  # EA-published reference, SY 8542 with canvas=(0,0)):
93
116
  # source-end pairs stack at the exit point (role +3/-23,
@@ -79,19 +79,22 @@ module Ea
79
79
  tree = tree_shaped?(points)
80
80
 
81
81
  stored_src = end_boxes(boxes, :llt, :llb)
82
+ stored_tgt = end_boxes(boxes, :lrt, :lrb)
83
+ stored_labels = !(stored_src.nil? && stored_tgt.nil?)
82
84
  src_tb, src_mb = stored_src || default_label_boxes(points, :source)
83
- tgt_tb, tgt_mb = end_boxes(boxes, :lrt, :lrb) ||
84
- default_label_boxes(points, :target)
85
+ tgt_tb, tgt_mb = stored_tgt || default_label_boxes(points, :target)
85
86
 
86
87
  texts = []
87
88
  end_renderer.texts(text_box: src_tb, mult_box: src_mb,
88
89
  anchor: source_pt, connector: connector,
89
90
  end_kind: :source, tree: tree && tree[:source],
90
- heading: stored_src && leg_heading(points)).each { |t| texts << t }
91
+ heading: stored_src && leg_heading(points),
92
+ stored_labels: stored_labels).each { |t| texts << t }
91
93
  end_renderer.texts(text_box: tgt_tb,
92
94
  mult_box: tgt_mb,
93
95
  anchor: target_pt, connector: connector,
94
- end_kind: :target, tree: tree && tree[:target]).each { |t| texts << t }
96
+ end_kind: :target, tree: tree && tree[:target],
97
+ stored_labels: stored_labels).each { |t| texts << t }
95
98
  texts
96
99
  end
97
100
 
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.92"
7
+ VERSION = "0.6.93"
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.92
4
+ version: 0.6.93
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.