ea 0.6.109 → 0.6.111

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: db09c594a106072a0600df4d18a9db32ac9823fe348d903440639946d4bbbc25
4
- data.tar.gz: e39606ab7c251e044d5f1918e624a088d4c812503a5899d5c2ce1bd2bf04b6f6
3
+ metadata.gz: 612161a78bd06432a03732a325ff6de795f200d37ee87c4dfe41a0e1b44bb39e
4
+ data.tar.gz: ec6d0535486058e4eaa38ef5fbbd2de7d88a601517f95b31e76142f4f0aa7f8a
5
5
  SHA512:
6
- metadata.gz: 8631b532ab58510c40589b8918fab7c03ec36f9c838a8497e985f38588b039c8ee1b77fba537506285d1b3771af156f44a7daf2824a335a4ae6514be6793b156
7
- data.tar.gz: 7f5e2eea1b46aa5ac9dc60e0d9a74e693bc7e47d965a46948c2621fcc9c4a9775732ffb2aab5c1b3c6a0a59806aab713eb64ae1cacd08d8e063bfe7f19b4ef2f
6
+ metadata.gz: 2374fbd101b31c488752c90eced651591271fa54ef2c5ae104641c8ae02c6183f5d62b17cb8b46e2b8a790728f04df6cea7e17d66c80feb699ab4fdcad55e686
7
+ data.tar.gz: 52d024c1f2cf5e2c1e2d69b4b1c9d1313aa27ab2548c36ca3232f9122de71e7dc21d0b8824a7f4a4803722afd57942660642bde9997240529b4b62945f25321a
@@ -72,6 +72,10 @@ module Ea
72
72
  # EA uses the attribute row point-size increment for literal names.
73
73
  offset = context.theme.attribute_spec.content_x_offset || 26
74
74
  offset += 2 * (context.size - 7) if context.size_unit == "pt"
75
+ if Ea::Fonts::Metrics.compact_compartment_font?(context.size,
76
+ family: context.family, unit: context.size_unit)
77
+ offset -= 1
78
+ end
75
79
  TextRenderer.new(
76
80
  content: content,
77
81
  x: context.bounds.x + offset,
@@ -14,8 +14,7 @@ module Ea
14
14
  Element::LegendRenderer.render(
15
15
  context.bounds,
16
16
  legend: context.model_element.legend,
17
- family: context.family,
18
- canvas: context.canvas
17
+ family: context.family
19
18
  )
20
19
  elsif context.model_element.is_a?(Ea::Model::Package) ||
21
20
  context.model_element.is_a?(Ea::Model::Note)
@@ -72,8 +72,19 @@ module Ea
72
72
  end
73
73
  private :line_height
74
74
 
75
+ # A source font can export at the same point size with a smaller
76
+ # logical cell. Seat its first baseline using the same height delta
77
+ # as its row pitch, without changing compact-font spacing.
78
+ def source_baseline_adjustment
79
+ nominal_height = Ea::Fonts::Metrics.compartment_line_height(
80
+ size, family: @family, unit: @size_unit, offset: 0
81
+ )
82
+ line_height(0) - nominal_height
83
+ end
84
+ private :source_baseline_adjustment
85
+
75
86
  def header_first_y
76
- bounds.y + size + (header_top_padding || 12)
87
+ bounds.y + size + (header_top_padding || 12) + source_baseline_adjustment
77
88
  end
78
89
 
79
90
  # Y of the divider line between header and the rest.
@@ -113,7 +124,7 @@ module Ea
113
124
  end
114
125
 
115
126
  def raw_attr_first_y
116
- return bounds.y + size + (header_top_padding || 12) + 12 unless divider_y
127
+ return header_first_y + 12 unless divider_y
117
128
 
118
129
  divider_y + line_height((attr_first_offset || 7) - 1) + 1
119
130
  end
@@ -9,7 +9,7 @@ module Ea
9
9
  # (verified against plateau reference SVGs):
10
10
  #
11
11
  # ┌──────────────────────────────┐
12
- # │ 凡例 │ ← title baseline 19px below top
12
+ # │ 凡例 │ ← title baseline 20px below top
13
13
  # │ ┌──┐ │
14
14
  # │ └──┘ GMLに定義されたクラス │ ← item 0 (icon top + 30px)
15
15
  # │ ┌──┐ │
@@ -24,8 +24,8 @@ module Ea
24
24
  class LegendRenderer
25
25
  CONTAINER_RX = 3
26
26
  ICON_SIZE = 17
27
- TITLE_Y_OFFSET = 22
28
- FIRST_ITEM_Y_OFFSET = 33
27
+ TITLE_Y_OFFSET = 20
28
+ FIRST_ITEM_Y_OFFSET = 30
29
29
  ITEM_SPACING = 19
30
30
  ICON_X_OFFSET = 10
31
31
  ICON_LABEL_GAP = 22
@@ -29,7 +29,7 @@ module Ea
29
29
  TAB_LABEL_PADDING = 10
30
30
  TAB_LABEL_X_OFFSET = 5
31
31
  TAB_LABEL_Y_OFFSET = 13
32
- TAB_LINE_OFFSET = 13
32
+ TAB_TEXT_PADDING = 6
33
33
  DEFAULT_TAB_WIDTH = 105
34
34
  # EA autosizes the TAB: max(text width + 15, 105). The BODY
35
35
  # width = max(stored rect, tab + 15): user-widened packages
@@ -116,21 +116,30 @@ module Ea
116
116
  bounds.x + TAB_LABEL_X_OFFSET
117
117
  end
118
118
 
119
- # Stereotype line baseline: 13px below the tab top.
120
119
  def stereotype_y
121
- tab_top_y + TAB_LABEL_Y_OFFSET
120
+ tab_top_y + first_baseline_offset
122
121
  end
123
122
 
124
- # Name baseline when stereotype is also rendered: 26px below
125
- # the tab top (one line below the stereotype).
126
123
  def name_y
127
- tab_top_y + TAB_LABEL_Y_OFFSET + TAB_LINE_OFFSET
124
+ stereotype_y + tab_line_height
128
125
  end
129
126
 
130
- # Name baseline when only the name renders (no stereotype):
131
- # 13px below the tab top.
132
127
  def name_y_single
133
- tab_top_y + TAB_LABEL_Y_OFFSET
128
+ stereotype_y
129
+ end
130
+
131
+ # Package tabs use the same font-size-plus-padding anchor as
132
+ # classifier headers, with a smaller top inset.
133
+ def first_baseline_offset
134
+ size_unit == "pt" ? size + TAB_TEXT_PADDING : TAB_LABEL_Y_OFFSET
135
+ end
136
+
137
+ def tab_line_height
138
+ return TAB_LABEL_Y_OFFSET unless size_unit == "pt"
139
+
140
+ Ea::Fonts::Metrics.compartment_line_height(
141
+ size, family: family, unit: size_unit, offset: TAB_TEXT_PADDING
142
+ )
134
143
  end
135
144
 
136
145
  # Tab occupies the top of the stored rect.
@@ -99,9 +99,10 @@ module Ea
99
99
  horizontal_tree_multiplicity(connector, direction, anchor, mult_box, mult) ||
100
100
  mult_seat(direction, anchor, mult_box) || mult_pos
101
101
  elsif end_kind == :target && !(tree && zero_offset?(text_box, mult_box))
102
- text_pos = target_vertical_role(connector, heading, anchor, text_box, role) ||
102
+ text_pos = target_property_role(connector, heading, anchor, text_box, role) ||
103
+ target_vertical_role(connector, heading, anchor, text_box, role) ||
103
104
  target_rightward_role(heading, anchor, text_box, role) || text_pos
104
- mult_pos = target_multiplicity_seat(heading, anchor, mult_box) ||
105
+ mult_pos = target_multiplicity_seat(connector, heading, anchor, mult_box) ||
105
106
  target_horizontal_multiplicity(heading, anchor, mult_box, mult) || mult_pos
106
107
  end
107
108
 
@@ -213,6 +214,25 @@ module Ea
213
214
  [x - SEAT_X_INSET - width, y - 6]
214
215
  end
215
216
 
217
+ # An upward target uses the downward property's right edge and
218
+ # the upward target baseline, both relative to its stored corner.
219
+ def target_property_role(connector, heading, anchor, box, role)
220
+ return nil unless upward_target_property?(connector, heading)
221
+ return nil unless plain_vertical_box?(box) && box["alignment"] == 1
222
+
223
+ width = Ea::Fonts::Metrics.text_length(role, font_size, family: font_family)
224
+ return nil unless width
225
+
226
+ x, y = seat_corner(anchor, box)
227
+ inset, = property_role_offsets(:down)
228
+ [x - inset - width, y - 7]
229
+ end
230
+
231
+ def upward_target_property?(connector, heading)
232
+ heading && heading[0].zero? && heading[1].negative? &&
233
+ property_label?(connector, :target) && downward_property_route?(connector.style.to_h)
234
+ end
235
+
216
236
  def target_vertical_role(connector, heading, anchor, box, role)
217
237
  return nil unless heading && heading[0].zero? && !heading[1].zero?
218
238
 
@@ -350,12 +370,19 @@ module Ea
350
370
  mult_seat(:right, anchor, box)
351
371
  end
352
372
 
353
- def target_multiplicity_seat(heading, anchor, box)
373
+ def target_multiplicity_seat(connector, heading, anchor, box)
354
374
  return nil unless seat_font?
355
375
  return nil unless heading && heading[0].zero? && heading[1].negative?
356
- return nil unless cambria_box?(box) && stored_offsets_zero?(box)
376
+ return nil unless target_multiplicity_box?(connector, box)
377
+
378
+ x, y = seat_corner(anchor, box)
379
+ [x + 8, y - 7]
380
+ end
357
381
 
358
- [anchor[0] + 8, anchor[1] - 7]
382
+ def target_multiplicity_box?(connector, box)
383
+ # Property targets seat at the stored corner; plain moved labels
384
+ # retain their explicit offsets.
385
+ cambria_box?(box) && (stored_offsets_zero?(box) || property_label?(connector, :target))
359
386
  end
360
387
 
361
388
  def cambria_box?(box)
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.109"
7
+ VERSION = "0.6.111"
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.109
4
+ version: 0.6.111
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.