ea 0.6.64 → 0.6.66
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 +4 -4
- data/lib/ea/svg/ea_emitter/element/operation_renderer.rb +1 -1
- data/lib/ea/svg/ea_emitter/elements.rb +40 -57
- data/lib/ea/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 53d5c1cd5e970e7c26ed55e55e86487d2907dc1aabf6d5ef179bca4a85c2cfdb
|
|
4
|
+
data.tar.gz: 9da246b062c598d455d7a3a13c7c5f0b0ac28fe9d141a19d26b5521b54d3b85f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d36f5777e743ce2b1ee995338e191b2fa6912622a6ab4a401449b3877880ab3c4cdac54ffb16be575758d436956eba86badaacf26a4e613299c68bc71d4c720
|
|
7
|
+
data.tar.gz: 50dd7b12049c64807c8e671e1e912f367b8f55e222a137e1e52ed7b4b950430d619882798934fd42f6560fd4182d3482cca2290fac8447d751e0b785bb202204
|
|
@@ -14,7 +14,7 @@ module Ea
|
|
|
14
14
|
# compartment for Klass / Interface classifiers.
|
|
15
15
|
class OperationRenderer
|
|
16
16
|
VISIBILITY_X_OFFSET = 5
|
|
17
|
-
CONTENT_X_OFFSET =
|
|
17
|
+
CONTENT_X_OFFSET = 22
|
|
18
18
|
|
|
19
19
|
def self.render(operations, bounds:, first_y:, family:, size:)
|
|
20
20
|
# EA's op rows pitch 13 (size + 6), same as attribute
|
|
@@ -83,7 +83,7 @@ module Ea
|
|
|
83
83
|
raw = element.bounds || element.image_bounds
|
|
84
84
|
return unless raw
|
|
85
85
|
|
|
86
|
-
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
|
|
@@ -166,11 +134,35 @@ module Ea
|
|
|
166
134
|
[]
|
|
167
135
|
end
|
|
168
136
|
op_lines = if is_classifier && show_operations? && operations_visible?(element)
|
|
169
|
-
$stderr.puts "DBG ops: show=#{show_operations?} vis=#{operations_visible?(element)} cls=#{classifier.class} nops=#{classifier.operations.to_a.size}"
|
|
170
137
|
Element::OperationRenderer.lines_for(classifier)
|
|
171
138
|
else
|
|
172
139
|
[]
|
|
173
140
|
end
|
|
141
|
+
# Regenerated contexts grow the DRAWN width to fit the
|
|
142
|
+
# widest row: attr rows inset 22 + 5 right, op rows inset
|
|
143
|
+
# 22 + 3 (CharacterString 197+27=224, Integer 92+25=117).
|
|
144
|
+
# Titles never drive growth - they wrap instead.
|
|
145
|
+
if attr_lines.any? || op_lines.any?
|
|
146
|
+
row_w = [row_content_width(attr_lines, 5, size, family),
|
|
147
|
+
row_content_width(op_lines, 3, size, family)].compact.max
|
|
148
|
+
if row_w && row_w > bounds.width
|
|
149
|
+
bounds = Ea::Model::Bounds.new(
|
|
150
|
+
x: bounds.x, y: bounds.y,
|
|
151
|
+
width: row_w,
|
|
152
|
+
height: bounds.height
|
|
153
|
+
)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
header_lines = classifier ? Element::HeaderLines.for(classifier,
|
|
157
|
+
diagram_package_id: diagram.package_id,
|
|
158
|
+
visually_nested: visually_nested?(element),
|
|
159
|
+
umldi_keyword: element.umldi_keyword,
|
|
160
|
+
bounds_width: bounds.width,
|
|
161
|
+
font_size: size,
|
|
162
|
+
family: family,
|
|
163
|
+
off_canvas_parent_name: parent_name,
|
|
164
|
+
foreign_package_name: foreign_package_name_for(classifier),
|
|
165
|
+
suppress_stereotypes: suppress_stereotypes?) : []
|
|
174
166
|
geometry = compartment_geometry(bounds, size, attr_lines, op_lines,
|
|
175
167
|
tagged_values_for(classifier).size,
|
|
176
168
|
header_lines, classifier: classifier,
|
|
@@ -278,6 +270,20 @@ module Ea
|
|
|
278
270
|
)
|
|
279
271
|
end
|
|
280
272
|
|
|
273
|
+
def row_content_width(lines, right_pad, size, family)
|
|
274
|
+
return nil if lines.to_a.empty?
|
|
275
|
+
|
|
276
|
+
tl = lines.filter_map do |line|
|
|
277
|
+
text = line.sub(/\A\S /, "")
|
|
278
|
+
Ea::Fonts::Metrics.text_length(text, size,
|
|
279
|
+
family: family,
|
|
280
|
+
weight: "400")&.round
|
|
281
|
+
end.max
|
|
282
|
+
return nil unless tl
|
|
283
|
+
|
|
284
|
+
22 + tl + right_pad
|
|
285
|
+
end
|
|
286
|
+
|
|
281
287
|
def compartment_geometry(bounds, size, attr_lines, op_lines,
|
|
282
288
|
tagged_count, header_lines, classifier: nil,
|
|
283
289
|
constraints_count: 0, marker_count: 0,
|
|
@@ -469,29 +475,6 @@ module Ea
|
|
|
469
475
|
diagram.style_ex.to_s !~ /SuppressFOC=1/
|
|
470
476
|
end
|
|
471
477
|
|
|
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
478
|
def foreign_package_name_for(classifier)
|
|
496
479
|
return nil unless diagram.show_foreign
|
|
497
480
|
return nil unless classifier.is_a?(Ea::Model::Classifier)
|
data/lib/ea/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ea
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.66
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lutaml-model
|