outro_rails 0.1.8 → 0.1.9

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: 7f73ddddb9f91e04692558bfb73bb13241299ca4a914d20b878c1f44132cfc20
4
- data.tar.gz: 1138e5cddc70b005f69b833b7ee39d868bbdbac599c29fedca71b3ef42c0edab
3
+ metadata.gz: be553169a45e21824a1d92e6287d3777e7bf78839cce188fe86d708d40496f26
4
+ data.tar.gz: 186d0ebf8b817cc88fde9561873e9949ed8f200658c0265f25162cfec56e9471
5
5
  SHA512:
6
- metadata.gz: 1b27a2bcd3a3415940a46816d772e504db463d9f90058b01dfdbaf284047e46914da8c9aecfd83afc2383651fba682fb642a81979b044f009bbf89845504e32f
7
- data.tar.gz: 72b5c7576c366c11e80963fdfaac49602729746e02c562158921545d1be426e61805d48dc5bfa9d142f2c81197b3ac318f5392c8d53a8ea2a608ecb3272461fe
6
+ metadata.gz: 9c6dc62087ae7a8a0c7e393ef4ad6767a846205e3fd87a797b6e7c9c6546f0da1c4be21056e48b3a797cb82352f51b057a729a3f828f15b4eb02b3d3ac68adad
7
+ data.tar.gz: 0dce5f67e95e032c29638e1da8799b626482f37efebb60ff7ec1daf678992732b54c42fbe34a1b30dd86a0e5ce17633e61b24b9d8a0d4b311bf6e83f97e94a35
@@ -36,12 +36,14 @@
36
36
  highlight_frets = guitar_positions(
37
37
  Array(local_assigns.fetch(:highlight_frets, [])).select(&complete)
38
38
  )
39
- highlight_color = local_assigns.fetch(:highlight_color, "#2f6bed")
39
+ highlight_color = local_assigns.fetch(:highlight_color,
40
+ "var(--outro-accent, #2f6bed)")
40
41
  root_frets = guitar_positions(
41
42
  Array(local_assigns.fetch(:root_frets, [])).select(&complete)
42
43
  )
43
44
  highlight_frets |= root_frets
44
- root_color = local_assigns.fetch(:root_color, "#d1495b")
45
+ root_color = local_assigns.fetch(:root_color,
46
+ "var(--outro-root, #d1495b)")
45
47
  prefer = local_assigns.fetch(:prefer, "sharps").to_sym
46
48
 
47
49
  open_midis = guitar_open_midis(tuning) # { 1 => 64, ..., 6 => 40 }
@@ -29,9 +29,11 @@
29
29
  default_tuning = OutroRails::InstrumentsHelper::GUITAR_STANDARD_TUNING
30
30
  tuning = local_assigns.fetch(:tuning, default_tuning)
31
31
  highlight_frets = guitar_positions(local_assigns.fetch(:highlight_frets, []))
32
- highlight_color = local_assigns.fetch(:highlight_color, "#2f6bed")
32
+ highlight_color = local_assigns.fetch(:highlight_color,
33
+ "var(--outro-accent, #2f6bed)")
33
34
  root_frets = guitar_positions(local_assigns.fetch(:root_frets, []))
34
- root_color = local_assigns.fetch(:root_color, "#d1495b")
35
+ root_color = local_assigns.fetch(:root_color,
36
+ "var(--outro-root, #d1495b)")
35
37
  prefer = local_assigns.fetch(:prefer, 'sharps')
36
38
 
37
39
  start_fret, end_fret = end_fret, start_fret if start_fret > end_fret
@@ -18,9 +18,11 @@
18
18
  start_note = local_assigns.fetch(:start_note, nil).presence || "C3"
19
19
  end_note = local_assigns.fetch(:end_note, nil).presence || "C5"
20
20
  highlight_keys = Array(local_assigns.fetch(:highlight_keys, []))
21
- highlight_color = local_assigns.fetch(:highlight_color, "#2f6bed")
21
+ highlight_color = local_assigns.fetch(:highlight_color,
22
+ "var(--outro-accent, #2f6bed)")
22
23
  root_keys = Array(local_assigns.fetch(:root_keys, []))
23
- root_color = local_assigns.fetch(:root_color, "#d1495b")
24
+ root_color = local_assigns.fetch(:root_color,
25
+ "var(--outro-root, #d1495b)")
24
26
  prefer = local_assigns.fetch(:prefer, "sharps").to_sym
25
27
 
26
28
  keys = piano_keys_between(start_note, end_note, prefer: prefer)
@@ -29,6 +31,8 @@
29
31
 
30
32
  white_w, white_h = 14, 46 # viewBox units
31
33
  black_w, black_h = 8.5, 28
34
+ stroke_w = 0.75
35
+ pad = stroke_w / 2.0
32
36
 
33
37
  whites = []
34
38
  blacks = []
@@ -60,23 +64,28 @@
60
64
  else
61
65
  "Piano keyboard from #{start_note} to #{end_note}"
62
66
  end
67
+
68
+ width = [white_index, 1].max * white_w
69
+ vb_w = width + (pad * 2)
70
+ vb_h = white_h + (pad * 2)
63
71
  %>
64
72
 
65
73
  <svg class="outro-figure__svg outro-figure__svg--piano"
66
- viewBox="0 0 <%= width %> <%= white_h %>"
67
- width="<%= (width * 0.9).round %>"
74
+ viewBox="<%= -pad %> <%= -pad %> <%= vb_w %> <%= vb_h %>"
75
+ width="<%= (vb_w * 0.9).round %>"
76
+ height="<%= (vb_h * 0.9).round %>"
68
77
  role="img"
69
78
  aria-label="<%= label %>">
70
79
  <% whites.each do |key| %>
71
80
  <rect x="<%= key[:x] %>" y="0"
72
81
  width="<%= white_w %>" height="<%= white_h %>"
73
82
  rx="1.5" fill="<%= fill_for.call(key) %>"
74
- stroke="#444444" stroke-width="0.75" />
83
+ stroke="#444444" stroke-width="<%= stroke_w %>" />
75
84
  <% end %>
76
85
  <% blacks.each do |key| %>
77
86
  <rect x="<%= key[:x] %>" y="0"
78
87
  width="<%= black_w %>" height="<%= black_h %>"
79
88
  rx="1.5" fill="<%= fill_for.call(key) %>"
80
- stroke="#111111" stroke-width="0.75" />
89
+ stroke="#111111" stroke-width="<%= stroke_w %>" />
81
90
  <% end %>
82
91
  </svg>
@@ -21,9 +21,11 @@
21
21
  start_note = local_assigns.fetch(:start_note, "C3")
22
22
  end_note = local_assigns.fetch(:end_note, "C5")
23
23
  highlight_keys = Array(local_assigns.fetch(:highlight_keys, []))
24
- highlight_color = local_assigns.fetch(:highlight_color, "#2f6bed")
24
+ highlight_color = local_assigns.fetch(:highlight_color,
25
+ "var(--outro-accent, #2f6bed)")
25
26
  root_keys = Array(local_assigns.fetch(:root_keys, []))
26
- root_color = local_assigns.fetch(:root_color, "#d1495b")
27
+ root_color = local_assigns.fetch(:root_color,
28
+ "var(--outro-root, #d1495b)")
27
29
  prefer = local_assigns.fetch(:prefer, 'sharps').to_sym
28
30
 
29
31
  keys = piano_keys_between(start_note, end_note, prefer: prefer)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OutroRails
4
- VERSION = "0.1.8"
4
+ VERSION = "0.1.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outro_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - endtoendpaper