ea 0.6.64 → 0.6.65

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: 357347a93b4240b35f3f0ea66e0e1200877e848b39e61b4d01e21e0276a67c04
4
- data.tar.gz: b06de8c2dd2c0a7a2b4afbf599a583c15df3c369aab983e8466b94807c77efc8
3
+ metadata.gz: 8ffac6574d00714dc4cf15762c28295af8c894481163916699eae211557fb1be
4
+ data.tar.gz: d36e97707d7d1b961f807d13874484dcd92e6324467b80c6a0a07cddba0dcdf7
5
5
  SHA512:
6
- metadata.gz: b702534b08da2779ea06bfe75a05b51c6d661999f59d3f6fadebee1785bebac67fed8a3a0dc93674cc64c9a4e01f1909e2f88f47dfb35165c4ff7c247585797d
7
- data.tar.gz: 7914343f39b14550f47f4ca43390de0eb786101d20e9f4437076582e92db7f1e031a6365ba61d92a8a71fb2eca1700f8a13e3f96d8ed6b83f78b66daad42691f
6
+ metadata.gz: 5fa4eef593858195a555722364870e9c1d86a0305417fdf113ab905dce3201a2a22c75b97ffe1410482522eb705a491fd2afd0dda86dab5730cfe9dff7c394b0
7
+ data.tar.gz: b6a3d1b3c66e31d6e2a8b3113ccdf453d3a6a2f8c98c205dccfb74b3ecb6464383774f5fff9e830d13e68b26bb2558acf1157ba3da9919198e06020930ca957a
@@ -83,7 +83,7 @@ module Ea
83
83
  raw = element.bounds || element.image_bounds
84
84
  return unless raw
85
85
 
86
- width = raw.width
86
+ width = context.bounds.width
87
87
  if classifier_package?(context.classifier)
88
88
  tab = Element::PackageShapeRenderer.autosized_tab_width(
89
89
  label: context.classifier.name.to_s,
@@ -118,38 +118,6 @@ module Ea
118
118
  size_unit = font_resolver.size_unit_for(element)
119
119
  parent_name = off_canvas_parent_name_for(classifier)
120
120
 
121
- header_lines = classifier ? Element::HeaderLines.for(classifier,
122
- diagram_package_id: diagram.package_id,
123
- visually_nested: visually_nested?(element),
124
- umldi_keyword: element.umldi_keyword,
125
- bounds_width: raw_bounds&.width,
126
- font_size: size,
127
- family: family,
128
- off_canvas_parent_name: parent_name,
129
- foreign_package_name: foreign_package_name_for(classifier),
130
- suppress_stereotypes: suppress_stereotypes?) : []
131
- # Regenerated contexts (SuppressFOC=0) re-size EVERY box to
132
- # fit ALL content (7F10BFBD: Set enum box stored 70x59 ->
133
- # EA 165x223 with all six literals unwrapped): width =
134
- # max(stored, title + pad_t, widest row + 8), height likewise
135
- # grows via the standard content growth. Frozen contexts
136
- # (SuppressFOC=1) keep stored sizes and wrap.
137
- if regenerated_context? && classifier.is_a?(Ea::Model::Classifier) &&
138
- !classifier.is_a?(Ea::Model::Package)
139
- preview_lines = []
140
- if show_attributes? && attributes_visible?(element) &&
141
- !classifier.is_a?(Ea::Model::Interface)
142
- preview_lines += Element::AttributeRenderer.lines_for(
143
- classifier, lookup: attribute_lookup,
144
- exclude_association_ids: drawn_association_ids
145
- )
146
- end
147
- if show_operations? && operations_visible?(element)
148
- preview_lines += Element::OperationRenderer.lines_for(classifier)
149
- end
150
- bounds = context_resized_bounds(bounds, classifier, size, family,
151
- preview_lines)
152
- end
153
121
 
154
122
  is_classifier = classifier.is_a?(Ea::Model::Classifier)
155
123
  # Interfaces DO render attribute compartments when they own
@@ -171,6 +139,31 @@ module Ea
171
139
  else
172
140
  []
173
141
  end
142
+ # Regenerated contexts grow the DRAWN width to fit the
143
+ # widest row: attr rows inset 22 + 5 right, op rows inset
144
+ # 22 + 3 (CharacterString 197+27=224, Integer 92+25=117).
145
+ # Titles never drive growth - they wrap instead.
146
+ if attr_lines.any? || op_lines.any?
147
+ row_w = [row_content_width(attr_lines, 5, size, family),
148
+ row_content_width(op_lines, 3, size, family)].compact.max
149
+ if row_w && row_w > bounds.width
150
+ bounds = Ea::Model::Bounds.new(
151
+ x: bounds.x, y: bounds.y,
152
+ width: row_w,
153
+ height: bounds.height
154
+ )
155
+ end
156
+ end
157
+ header_lines = classifier ? Element::HeaderLines.for(classifier,
158
+ diagram_package_id: diagram.package_id,
159
+ visually_nested: visually_nested?(element),
160
+ umldi_keyword: element.umldi_keyword,
161
+ bounds_width: bounds.width,
162
+ font_size: size,
163
+ family: family,
164
+ off_canvas_parent_name: parent_name,
165
+ foreign_package_name: foreign_package_name_for(classifier),
166
+ suppress_stereotypes: suppress_stereotypes?) : []
174
167
  geometry = compartment_geometry(bounds, size, attr_lines, op_lines,
175
168
  tagged_values_for(classifier).size,
176
169
  header_lines, classifier: classifier,
@@ -278,6 +271,20 @@ module Ea
278
271
  )
279
272
  end
280
273
 
274
+ def row_content_width(lines, right_pad, size, family)
275
+ return nil if lines.to_a.empty?
276
+
277
+ tl = lines.filter_map do |line|
278
+ text = line.sub(/\A\S /, "")
279
+ Ea::Fonts::Metrics.text_length(text, size,
280
+ family: family,
281
+ weight: "400")&.round
282
+ end.max
283
+ return nil unless tl
284
+
285
+ 22 + tl + right_pad
286
+ end
287
+
281
288
  def compartment_geometry(bounds, size, attr_lines, op_lines,
282
289
  tagged_count, header_lines, classifier: nil,
283
290
  constraints_count: 0, marker_count: 0,
@@ -469,29 +476,6 @@ module Ea
469
476
  diagram.style_ex.to_s !~ /SuppressFOC=1/
470
477
  end
471
478
 
472
- TITLE_PAD = 18
473
-
474
- def context_resized_bounds(bounds, classifier, size, family, rows)
475
- label = classifier.name.to_s
476
- pkg = foreign_package_name_for(classifier)
477
- label = "#{pkg}::#{label}" if pkg
478
- title_w = TextRenderer.estimate_width(
479
- label, size, nil, family: family, weight: "700"
480
- ).round
481
- pad = title_w.odd? ? TITLE_PAD : 16
482
- row_w = rows.map do |line|
483
- line = line.sub(/\A«[^»]*»\z/, "")
484
- TextRenderer.estimate_width(
485
- line, size, nil, family: family, weight: "400"
486
- ).round + 8
487
- end.max.to_i
488
- needed = [bounds.width, title_w + pad, row_w].max
489
- return bounds if needed <= bounds.width
490
-
491
- Ea::Model::Bounds.new(x: bounds.x, y: bounds.y,
492
- width: needed, height: bounds.height)
493
- end
494
-
495
479
  def foreign_package_name_for(classifier)
496
480
  return nil unless diagram.show_foreign
497
481
  return nil unless classifier.is_a?(Ea::Model::Classifier)
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.64"
7
+ VERSION = "0.6.65"
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.64
4
+ version: 0.6.65
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.