ea 0.6.125 → 0.6.127

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: ee64290319fb525469230eeb6d6f1fc2b923a8a2d82115c6f297d98d0d90e10b
4
- data.tar.gz: 76d8ead072a4ea88a2429cc506ecc410a62cd5755688b53d88cf5df41866fbc7
3
+ metadata.gz: 78f923bf1924106f7e6853841f3470c198e6ed0c9198e4501acd63aa3e84b3b6
4
+ data.tar.gz: 46975a9dd5d9f80c027a4b7f906abb2dfaff6d7bfdcc8b0af82f3ce390f6a2c6
5
5
  SHA512:
6
- metadata.gz: 43f49df97683830c845d3124dbc36de402fa482c3c90362477d594087e5c8267083aae48e81bdfd0c0a341a4a71b729b75d7ba26245dc2e9001895333237dc2b
7
- data.tar.gz: fe1b7a4c60545649fbabb1d24312959ba1a74f0c73b9e299d3518c0e7c4b7ae166843481c12a523398b704805c999fbb1d692bfb051faf53b6603e08299069a4
6
+ metadata.gz: e9b5fcacddafe90bac1b21015a6649227fd9676e01e8f5367e9eec96c0eac8712ff6303e49fadfa1d3db0c19c648eec056030ddcdb0e8d68609191502fd26193
7
+ data.tar.gz: 3f95877c62d6dc05b74096bba8ecd49961a2c40bd363a98fde2d5e27f53a31e43ecb871a210e010ef5721b7c6e4d58c2cd94c6bf16e3826a712e80c1f0f7055e
@@ -555,7 +555,7 @@ module Ea
555
555
  end
556
556
 
557
557
  # A width-2 Mode 3 route without a tree style keeps authored orthogonal
558
- # bends: two corners for Associations, three or more for Aggregations.
558
+ # bends: two corners for Associations, two or more for Aggregations.
559
559
  # Each end docks on
560
560
  # the 1px outline its adjacent leg points at, from the corner's own
561
561
  # coordinate; any end that cannot do so leaves the route unchanged.
@@ -569,7 +569,13 @@ module Ea
569
569
 
570
570
  first = outline_dock(corners[0], corners[1], source)
571
571
  last = outline_dock(corners[-1], corners[-2], target)
572
- [first, *corners, last] if first && last
572
+ return nil unless distinct_stair_docks?(corners, first, last)
573
+
574
+ [first, *corners, last]
575
+ end
576
+
577
+ def distinct_stair_docks?(corners, first, last)
578
+ first && last && first != corners.first && last != corners.last
573
579
  end
574
580
 
575
581
  def stair_style?(link_row, connector)
@@ -579,7 +585,7 @@ module Ea
579
585
  end
580
586
 
581
587
  def stair_corner_count?(corners, connector_type)
582
- connector_type == "Association" ? corners.size == 2 : corners.size >= 3
588
+ connector_type == "Association" ? corners.size == 2 : corners.size >= 2
583
589
  end
584
590
 
585
591
  # Every leg is non-zero and runs along the opposite axis of the last.
@@ -70,7 +70,7 @@ module Ea
70
70
  content = "#{slot.name} #{slot.op} #{slot.value}"
71
71
  TextRenderer.new(
72
72
  content: content,
73
- x: bounds.x + (context.theme.attribute_spec.content_x_offset || 26),
73
+ x: bounds.x + content_x_offset(context),
74
74
  y: y_pos,
75
75
  family: context.family, size: context.size,
76
76
  size_unit: context.size_unit, logical_height: context.logical_height, fill: fill
@@ -78,6 +78,16 @@ module Ea
78
78
  end
79
79
  module_function :line_text
80
80
 
81
+ def content_x_offset(context)
82
+ offset = context.theme.attribute_spec.content_x_offset || 26
83
+ if Ea::Fonts::Metrics.compact_compartment_font?(context.size,
84
+ family: context.family, unit: context.size_unit)
85
+ offset -= 1
86
+ end
87
+ offset
88
+ end
89
+ module_function :content_x_offset
90
+
81
91
  def subtitle_text(text, bounds, y_pos, context, fill)
82
92
  estimated_width = text.length * context.size * 0.5
83
93
  x_pos = bounds.x + (bounds.width - estimated_width) / 2.0
@@ -154,18 +154,11 @@ module Ea
154
154
  (block_left + (block_right - block_left - title_text_width.round) / 2.0).floor
155
155
  end
156
156
 
157
- CJK_RANGE = /[\u3000-\u9fff\uff00-\uffef]/
158
-
159
- # Real font metrics when available; legacy per-char
160
- # estimate otherwise (families without metric tables).
161
157
  def estimated_width(text, size, weight: nil, logical_height: nil, text_family: family)
162
- measured = Ea::Fonts::Metrics.text_length(text, size, family: text_family, weight: weight,
163
- logical_height: logical_height)
164
- return measured if measured
165
-
166
- text.to_s.each_char.sum do |ch|
167
- ch.match?(CJK_RANGE) ? size * 0.70 : size * 0.612
168
- end
158
+ TextRenderer.estimate_width(
159
+ text, size, family: text_family, weight: weight,
160
+ logical_height: logical_height
161
+ ).round
169
162
  end
170
163
 
171
164
  def widest_item_label_width
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.125"
7
+ VERSION = "0.6.127"
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.125
4
+ version: 0.6.127
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.