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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7fcedda4b91a88d79b8f5465244ee52b36fd404ac2b857bc1d1451894a6e3c7
|
|
4
|
+
data.tar.gz: 830e1eaa359016448a29883887c4648f026868c634df5c4debb2364416b1d14a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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:
|
|
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
|
-
|
|
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 +
|
|
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