|
1 | 1 | <svg
|
2 | 2 | xmlns="http://www.w3.org/2000/svg"
|
3 | 3 | xmlns:xlink="http://www.w3.org/1999/xlink"
|
4 |
| - width={(@cols + 2) * 8.433333333} |
5 |
| - height={(@rows + 1) * 14 * 1.333333} |
| 4 | + width={w(@cols + 2)} |
| 5 | + height={h(@rows + 1)} |
6 | 6 | font-family={
|
7 | 7 | {:safe,
|
8 | 8 | @font_family ||
|
9 | 9 | "Consolas, Menlo, 'Bitstream Vera Sans Mono', monospace, 'Powerline Symbols'"}
|
10 | 10 | }
|
11 |
| - font-size="14px" |
| 11 | + font-size={"#{font_size()}px"} |
12 | 12 | >
|
13 | 13 | <style>
|
14 | 14 | .br { font-weight: bold }
|
|
25 | 25 | ry={assigns[:ry] || 4}
|
26 | 26 | />
|
27 | 27 |
|
28 |
| - <svg |
29 |
| - x={percent(1.0 * 100 / (@cols + 2))} |
30 |
| - y={percent(0.5 * 100 / (@rows + 1))} |
31 |
| - class="default-text-fill" |
32 |
| - > |
| 28 | + <svg x={x(1)} y={y(0.5)} class="default-text-fill"> |
33 | 29 | <g style="shape-rendering: optimizeSpeed">
|
34 |
| - <%= for %{y: y, segments: segments} <- bg_coords(@snapshot) do %> |
| 30 | + <%= for %{y: y, segments: segments} <- @coords.bg do %> |
35 | 31 | <rect
|
36 |
| - :for={segment <- segments} |
37 |
| - x={percent(100 * segment.x / (@cols + 2))} |
38 |
| - y={percent(100 * y / (@rows + 1))} |
39 |
| - width={percent(100 * segment.width / (@cols + 2))} |
40 |
| - height="19.7" |
41 |
| - style={bg_style(segment.attrs, @theme)} |
| 32 | + :for={%{x: x, width: width, attrs: attrs} <- segments} |
| 33 | + x={x(x)} |
| 34 | + y={y(y)} |
| 35 | + width={w(width)} |
| 36 | + height={h(1)} |
| 37 | + style={bg_style(attrs, @theme)} |
42 | 38 | />
|
43 | 39 | <% end %>
|
| 40 | + |
| 41 | + <%= for %{y: y, segments: segments} <- @coords.special_chars do %> |
| 42 | + <%= for %{x: x, text: char, attrs: attrs} <- segments do %> |
| 43 | + <.special_char char={char} x={x} y={y} attrs={attrs} theme={@theme} /> |
| 44 | + <% end %> |
| 45 | + <% end %> |
44 | 46 | </g>
|
45 | 47 |
|
46 | 48 | <text style={"fill: " <> @theme.fg}>
|
47 |
| - <tspan |
48 |
| - :for={%{y: y, segments: segments} <- text_coords(@snapshot)} |
49 |
| - y={percent(100 * y / (@rows + 1))} |
50 |
| - > |
| 49 | + <tspan :for={%{y: y, segments: segments} <- @coords.text} y={y(y)}> |
51 | 50 | <tspan
|
52 |
| - :for={{segment, i} <- Enum.with_index(segments)} |
| 51 | + :for={{%{x: x, text: text, attrs: attrs}, i} <- Enum.with_index(segments)} |
53 | 52 | dy={
|
54 | 53 | if i == 0 do
|
55 | 54 | "1em"
|
56 | 55 | end
|
57 | 56 | }
|
58 |
| - x={percent(100 * segment.x / (@cols + 2))} |
59 |
| - {text_extra_attrs(segment.attrs, @theme)} |
| 57 | + x={x(x)} |
| 58 | + {text_extra_attrs(attrs, @theme)} |
60 | 59 | >
|
61 |
| - <%= html_escape(segment.text) %> |
| 60 | + <%= html_escape(text) %> |
62 | 61 | </tspan>
|
63 | 62 | </tspan>
|
64 | 63 | </text>
|
|
0 commit comments