ea 0.6.109 → 0.6.110

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: 55380e3923a2afe6babb0b3163079cc273e7f054cc8d1549db7985ace1f45757
4
+ data.tar.gz: dd92a38559eb5c1688771391995247055d633530fdcb4712a62aa087a31bfbf4
5
5
  SHA512:
6
- metadata.gz: 8631b532ab58510c40589b8918fab7c03ec36f9c838a8497e985f38588b039c8ee1b77fba537506285d1b3771af156f44a7daf2824a335a4ae6514be6793b156
7
- data.tar.gz: 7f5e2eea1b46aa5ac9dc60e0d9a74e693bc7e47d965a46948c2621fcc9c4a9775732ffb2aab5c1b3c6a0a59806aab713eb64ae1cacd08d8e063bfe7f19b4ef2f
6
+ metadata.gz: 9c98de5218163ad487eb0453bcf8fca9ea844a8cecbe3d36856ce2a44ab5728a691792d9a112c9efdf4f1e4084360a655052494af40764e339f0086692c8f6d8
7
+ data.tar.gz: 83fe0979cd7213d32a2615efd5d8e4f54f22c4c94761f5ec8bc15da01adf5070878fe937475a7424a8e8afc144cff1b0bc3620137bd491584d59cbb4733a75cf
@@ -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
@@ -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.110"
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.110
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.