ea 0.6.66 → 0.6.68

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: 53d5c1cd5e970e7c26ed55e55e86487d2907dc1aabf6d5ef179bca4a85c2cfdb
4
- data.tar.gz: 9da246b062c598d455d7a3a13c7c5f0b0ac28fe9d141a19d26b5521b54d3b85f
3
+ metadata.gz: c7fcedda4b91a88d79b8f5465244ee52b36fd404ac2b857bc1d1451894a6e3c7
4
+ data.tar.gz: 830e1eaa359016448a29883887c4648f026868c634df5c4debb2364416b1d14a
5
5
  SHA512:
6
- metadata.gz: 4d36f5777e743ce2b1ee995338e191b2fa6912622a6ab4a401449b3877880ab3c4cdac54ffb16be575758d436956eba86badaacf26a4e613299c68bc71d4c720
7
- data.tar.gz: 50dd7b12049c64807c8e671e1e912f367b8f55e222a137e1e52ed7b4b950430d619882798934fd42f6560fd4182d3482cca2290fac8447d751e0b785bb202204
6
+ metadata.gz: f20b3391834fb6eb79400b6b502eed84b3cc557438a69699061a54a11368b88588c955285be2bff805600f8d5a70ba274d0f9f89157311ee9ec8130e978c8cd1
7
+ data.tar.gz: c0408d5d3094d7111a01c9ef62ccf2ad44949006a7366a60e1e708612af285863fe476a6a7e977f078b8d798a71f5045ece48578a16d407e8dc945e4be9f3b54
@@ -10,17 +10,27 @@ module Ea
10
10
  class AttributeRenderer
11
11
  DEFAULT_VISIBILITY_X_OFFSET = 5
12
12
  DEFAULT_CONTENT_X_OFFSET = 22
13
+
13
14
  DEFAULT_FONT_UNIT = "pt"
14
15
  # EA seats compartment stereotype headers («Property») 12px
15
16
  # from the box edge and spaces rows 13px at 7pt.
16
17
  STEREOTYPE_HEADER_X_OFFSET = 12
17
18
  ROW_LINE_OFFSET = 6
18
19
 
20
+
21
+ # EA scales the row text inset with point size:
22
+ # 7pt rows sit at box.x+22, 9pt at box.x+26 (the '+ '
23
+ # visibility run stays at box.x+5 for both).
24
+ def self.content_x_offset(size)
25
+ DEFAULT_CONTENT_X_OFFSET + 2 * (size - 7)
26
+ end
27
+
19
28
  def self.render(lines, bounds:, first_y:, family:,
20
29
  size:, size_unit: DEFAULT_FONT_UNIT,
21
30
  fill: "#000000",
22
31
  visibility_x_offset: DEFAULT_VISIBILITY_X_OFFSET,
23
- content_x_offset: DEFAULT_CONTENT_X_OFFSET)
32
+ content_x_offset: nil)
33
+
24
34
  line_h = size + ROW_LINE_OFFSET
25
35
  text_blocks = []
26
36
  lines.each_with_index do |line, idx|
@@ -28,7 +38,9 @@ module Ea
28
38
  visibility, rest = split_visibility(line)
29
39
  if visibility
30
40
  text_blocks << build_text(bounds.x + visibility_x_offset, y, visibility, family, size, size_unit, fill)
31
- text_blocks << build_text(bounds.x + content_x_offset, y, rest, family, size, size_unit, fill)
41
+ offset = (content_x_offset || DEFAULT_CONTENT_X_OFFSET) +
42
+ 2 * (size - 7)
43
+ text_blocks << build_text(bounds.x + offset, y, rest, family, size, size_unit, fill)
32
44
  elsif line.strip.start_with?("«")
33
45
  text_blocks << build_text(bounds.x + STEREOTYPE_HEADER_X_OFFSET, y, line.strip, family, size, size_unit, fill)
34
46
  else
@@ -37,7 +37,7 @@ module Ea
37
37
  y = first_y + ((idx + offset) * line_h)
38
38
  text_blocks << build_text(bounds.x + VISIBILITY_X_OFFSET, y,
39
39
  visibility_prefix(op), family, size)
40
- text_blocks << build_text(bounds.x + CONTENT_X_OFFSET, y,
40
+ text_blocks << build_text(bounds.x + AttributeRenderer.content_x_offset(size), y,
41
41
  operation_text(op), family, size)
42
42
  end
43
43
  %(<g style="#{Style::TEXT_GROUP}">\n#{text_blocks.join("\n")}\n</g>)
@@ -124,8 +124,15 @@ module Ea
124
124
  # attribute rows (936AA434/Surface lists its nine 19107
125
125
  # attributes); the earlier corpus evidence for
126
126
  # header-only interfaces was zero-attribute leaf types.
127
+ # Regenerated contexts ignore stored per-element visibility
128
+ # toggles - EXCEPT for boxes whose only rows are
129
+ # association-derived properties (5833A95E keeps those
130
+ # suppressed even on FOC=0; 0CABA7D7 shows its association
131
+ # row because the class also owns real attributes).
127
132
  attr_lines = if is_classifier && show_attributes? &&
128
- attributes_visible?(element)
133
+ (attributes_visible?(element) ||
134
+ (regenerated_context? &&
135
+ classifier.properties.to_a.any? { |pr| !pr.association_id }))
129
136
  Element::AttributeRenderer.lines_for(
130
137
  classifier, lookup: attribute_lookup,
131
138
  exclude_association_ids: drawn_association_ids
@@ -133,7 +140,8 @@ module Ea
133
140
  else
134
141
  []
135
142
  end
136
- op_lines = if is_classifier && show_operations? && operations_visible?(element)
143
+ op_lines = if is_classifier && show_operations? &&
144
+ (operations_visible?(element) || regenerated_context?)
137
145
  Element::OperationRenderer.lines_for(classifier)
138
146
  else
139
147
  []
@@ -471,8 +479,7 @@ module Ea
471
479
  # (descendant packages included). Corpus-verified (450
472
480
  # diagrams): ShowForeign=0 renders plain everywhere.
473
481
  def regenerated_context?
474
- diagram.name.to_s.downcase.start_with?("context diagram") &&
475
- diagram.style_ex.to_s !~ /SuppressFOC=1/
482
+ diagram.style_ex.to_s !~ /SuppressFOC=1/
476
483
  end
477
484
 
478
485
  def foreign_package_name_for(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.66"
7
+ VERSION = "0.6.68"
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.66
4
+ version: 0.6.68
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.