ea 0.6.67 → 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: cd6ba69d90eb60d981290b5b07467b15b44a95859723aeaa9a3d1ba2d2a8cc82
4
- data.tar.gz: d70d59e8e12fb1fef32cdcbfaadfeaf9f80b9eb633a4f86d55fde8bddf6e9832
3
+ metadata.gz: c7fcedda4b91a88d79b8f5465244ee52b36fd404ac2b857bc1d1451894a6e3c7
4
+ data.tar.gz: 830e1eaa359016448a29883887c4648f026868c634df5c4debb2364416b1d14a
5
5
  SHA512:
6
- metadata.gz: a42427c7db0b6015749560e6239752c5ad8ac6b2daed788c91ea6a1cbfa22460e132388928e82503d06749a2b85bab00198d5250db422c0bd7beaaa4baba6df2
7
- data.tar.gz: 914844e0e278292ed0e918cebcfeda3268d79fff8afc679b4c1c5a4e64fce104271e08f73b3bf7c0430d32cb71f5c0e234707215ef0a01c24b098756af1a2314
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>)
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.67"
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.67
4
+ version: 0.6.68
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.