esvg 4.6.4 → 4.6.5
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/esvg/symbol.rb +17 -3
- data/lib/esvg/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a923b958651d7138656c6c84a668b9dbb2f71256d8d5d05804fec04415a6cb41
|
4
|
+
data.tar.gz: 0a2bce06990bf4d10357d16403bee18c4ff58aceba9384d42c87676660a0b782
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d6779bebdb391b4077f614acb9945b887393e2abaec8fbe22d26e099dabaa2fc382c5edc1a8c5bc85c67e922ef201a77caa6948e74606d0e30285813fae9b92
|
7
|
+
data.tar.gz: 8d763eca1893d21b749df6c947e9e8ef87925ec7c86cf1e356475f326660cceb97c6f244fd5bb06b5371e9999da24132ca53094fda7d8448e11388f1a05707ee
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 4.6.5 (2018-01-10)
|
4
|
+
- Fix: If a viewbox is missing, Esvg recontstructs it from width and height parameters.
|
5
|
+
|
6
|
+
### 4.6.4 (2018-01-10)
|
7
|
+
- JS files now load via ERB for code readability.
|
8
|
+
- Embed of SVGs is now triggered by document.body existing using requestAnimationFrame. DomContentLoaded wasn't fast enough for some cases.
|
9
|
+
|
3
10
|
### 4.6.3 (2018-12-19)
|
4
11
|
- Fix: Reworked configuration model, fixing build optimization failures.
|
5
12
|
|
data/lib/esvg/symbol.rb
CHANGED
@@ -59,8 +59,12 @@ module Esvg
|
|
59
59
|
|
60
60
|
# Scale width based on propotion to height
|
61
61
|
def scale_width( h )
|
62
|
-
|
63
|
-
|
62
|
+
begin
|
63
|
+
s = split_unit( h )
|
64
|
+
"#{( s[:size] / height * width ).round(2)}#{s[:unit]}"
|
65
|
+
rescue StandardError
|
66
|
+
binding.pry
|
67
|
+
end
|
64
68
|
end
|
65
69
|
|
66
70
|
# Scale height based on propotion to width
|
@@ -282,7 +286,17 @@ module Esvg
|
|
282
286
|
height: (coords[3].to_i - coords[1].to_i).abs
|
283
287
|
}
|
284
288
|
else
|
285
|
-
|
289
|
+
# In case a viewbox hasn't been set, derive one.
|
290
|
+
if height = @content.scan(/<svg.+(height=["'](.+?)["'])/).flatten.last &&
|
291
|
+
width = @content.scan(/<svg.+(width=["'](.+?)["'])/).flatten.last
|
292
|
+
{
|
293
|
+
viewBox: "0 0 #{width} #{height}",
|
294
|
+
width: width.to_i,
|
295
|
+
height: height.to_i
|
296
|
+
}
|
297
|
+
else
|
298
|
+
{}
|
299
|
+
end
|
286
300
|
end
|
287
301
|
end
|
288
302
|
|
data/lib/esvg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esvg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.6.
|
4
|
+
version: 4.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -116,8 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
|
-
|
120
|
-
rubygems_version: 2.7.6
|
119
|
+
rubygems_version: 3.0.3
|
121
120
|
signing_key:
|
122
121
|
specification_version: 4
|
123
122
|
summary: Embed svgs in HTML or CSS
|