ea 0.6.31 → 0.6.32

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: da25cfb5a4f0690b2b73df2d3c12fe3cd042c96fe6aab67d07e2c8871868feaf
4
- data.tar.gz: 8be40d4bb501b904f1ba2609446d332ea260f3d04a831528d213d6747e352dfa
3
+ metadata.gz: 6e23a708761ca82e0a23584e7c5ee557251532481defbd16712c676963ad7fbe
4
+ data.tar.gz: dfaeae3624f35848cf7d801e5fdf9c1bf990fa162514838353b98b282da76e51
5
5
  SHA512:
6
- metadata.gz: 271180e45139ae7e67a63a66a9fd78c8311edd379ee73f3a5ab9241f7b43d1be737bffca276e0585473f0294f1f557d3ff46fb254cdd105b8b6526ffb052fd36
7
- data.tar.gz: 63856efa026109bf92d89468c10e6325f9a2f411e4f49217335667b590842d1b5f8f0f860f17c3527bb57236a3d096729ae411a9c3166c4f4efbb169db30eea0
6
+ metadata.gz: 8efc865e83d8c43843f276c3307158b90ea6674bdf252f39804c48f8cab7c98c765536f1b382773efe2a4a6fd629f97acb6e35d37fd545cdcd5a70f18b98f387
7
+ data.tar.gz: 9eee4896484462b96f7060de2700e893ab4cd2a76b6d4ee7217e1908d5003767914d4e80a9c06a9cea8723ca609f2bae965b903a86660000d2690d39ca442e92
@@ -165,8 +165,8 @@ module Ea
165
165
  target = diagram_object_placement(diagram_row.diagram_id, target_id)
166
166
  return nil unless source && target
167
167
 
168
- source_bounds = bounds_from_rect(source)
169
- target_bounds = bounds_from_rect(target)
168
+ source_bounds = drawn_bounds_for(source)
169
+ target_bounds = drawn_bounds_for(target)
170
170
  waypoints = if source_id == target_id
171
171
  self_loop_waypoints(source_bounds)
172
172
  else
@@ -224,8 +224,8 @@ module Ea
224
224
  target_placement = diagram_object_placement(diagram_row.diagram_id, target_id)
225
225
  return nil unless source_placement && target_placement
226
226
 
227
- source_bounds = bounds_from_rect(source_placement)
228
- target_bounds = bounds_from_rect(target_placement)
227
+ source_bounds = drawn_bounds_for(source_placement)
228
+ target_bounds = drawn_bounds_for(target_placement)
229
229
  waypoints = direct_waypoints(source_bounds, target_bounds)
230
230
  Ea::Model::DiagramConnector.new(
231
231
  id: IdNormalizer.synthetic("xc", diagram_row.diagram_id, object_id),
@@ -383,7 +383,33 @@ module Ea
383
383
  connector.end_object_id)
384
384
  return [] unless source && target
385
385
 
386
- direct_waypoints(bounds_from_rect(source), bounds_from_rect(target))
386
+ direct_waypoints(drawn_bounds_for(source),
387
+ drawn_bounds_for(target))
388
+ end
389
+
390
+ # The outline EA clips connector rays against: the DRAWN
391
+ # autosized box, not the stored logical rect. Packages draw
392
+ # narrower than their stored rect (body = autosized tab +
393
+ # 15), so their docks land on the drawn edges (E58034A3:
394
+ # supplier right-edge dock 155 drawn vs 121 stored). All
395
+ # other element kinds draw at the stored rect.
396
+ PACKAGE_BODY_EXTRA = 15
397
+
398
+ def drawn_bounds_for(placement)
399
+ logical = bounds_from_rect(placement)
400
+ obj = database.find_object(placement.ea_object_id.to_i)
401
+ return logical unless obj && obj.object_type == "Package"
402
+
403
+ tab = ::Ea::Svg::EaEmitter::Element::PackageShapeRenderer
404
+ .autosized_tab_width(label: obj.name.to_s,
405
+ stereotype: obj.stereotype.to_s,
406
+ size: 7)
407
+ Ea::Model::Bounds.new(
408
+ x: logical.x,
409
+ y: logical.y,
410
+ width: tab + PACKAGE_BODY_EXTRA,
411
+ height: logical.height
412
+ )
387
413
  end
388
414
 
389
415
  # Straight-line waypoints between the two box-outline
@@ -58,17 +58,23 @@ module Ea
58
58
  pts = waypoints_for(connector)
59
59
  return nil if pts.size < 2
60
60
 
61
- d = pts.each_with_index.map do |p, idx|
62
- x, y = translate_point(p)
63
- "#{idx.zero? ? 'M' : 'L'} #{Canvas.coord(x)} #{Canvas.coord(y)}"
64
- end.join(" ")
65
- # EA writes a trailing zero-length "M <start>" repeat for
66
- # DIRECT (auto-routed straight) connectors — verified on
67
- # context diagrams where every line carries it (B6847577,
68
- # E58034A3, 8CF27BE8).
61
+ # DIRECT (auto-routed straight) connectors: EA writes the
62
+ # segment TARGET-FIRST with a trailing zero-length repeat —
63
+ # "M target L source M target" (B6847577, E58034A3,
64
+ # 8CF27BE8). Same pixels as source-first; only the byte
65
+ # order differs, so reversal lives here at the emitter and
66
+ # the marker anchoring (source = first waypoint) is
67
+ # untouched.
69
68
  if pts.size == 2 && direct?(connector)
70
- x, y = translate_point(pts.first)
71
- d = "#{d} M #{Canvas.coord(x)} #{Canvas.coord(y)}"
69
+ x1, y1 = translate_point(pts.first)
70
+ x2, y2 = translate_point(pts.last)
71
+ d = "M #{Canvas.coord(x2)} #{Canvas.coord(y2)} L #{Canvas.coord(x1)} #{Canvas.coord(y1)} " \
72
+ "M #{Canvas.coord(x2)} #{Canvas.coord(y2)}"
73
+ else
74
+ d = pts.each_with_index.map do |p, idx|
75
+ x, y = translate_point(p)
76
+ "#{idx.zero? ? 'M' : 'L'} #{Canvas.coord(x)} #{Canvas.coord(y)}"
77
+ end.join(" ")
72
78
  end
73
79
  %(<path d="#{d}" shape-rendering="auto"/>)
74
80
  end
@@ -44,7 +44,19 @@ module Ea
44
44
  !attr_lines.empty? || !op_lines.empty? ||
45
45
  enum_literals.any? || tagged_values.any? ||
46
46
  (constraints&.any?) ||
47
- (!package_content_lines.nil? && !package_content_lines.empty?)
47
+ (!package_content_lines.nil? && !package_content_lines.empty?) ||
48
+ hidden_features_present?
49
+ end
50
+
51
+ # EA draws the header divider whenever the element HAS a
52
+ # feature compartment — even one whose rows are all hidden
53
+ # by visibility flags (10E3E08A: CodeList with 3 attributes
54
+ # toggled off still renders the divider over an empty body;
55
+ # only feature-less elements omit it).
56
+ def hidden_features_present?
57
+ return false unless classifier.respond_to?(:properties)
58
+
59
+ classifier.properties.any? || classifier.operations.any?
48
60
  end
49
61
  end
50
62
  end
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.31"
7
+ VERSION = "0.6.32"
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.31
4
+ version: 0.6.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.