esvg 2.2.5 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffcdbe8ce8225cbd64f413b9c751eb6bc7ebac9d
4
- data.tar.gz: 28b86ddd6089af733612f1efafcb682793c75115
3
+ metadata.gz: 4203297d1baa968efa916d3efacaa3b62faea259
4
+ data.tar.gz: 6f94000f4b5c4087b08396b2fec368b0fbf13746
5
5
  SHA512:
6
- metadata.gz: 1e139f4210dd45a26bca37a0547ee10e249636bfd00dcc7d1eb573852f7c7e1dc1e903147eb6737ac5c1b491d33cafde0ea541a79d243c18809c2ab1e48116b9
7
- data.tar.gz: ce200dc8ac31246b88cd5bc1a225b2f089da38ab624f715c1fb607db88512555a50e46e8b0c97917d01934c4949505aaa9888bfbe847ffa23022da4f78e78ee6
6
+ metadata.gz: c80284abcae923930e8beb6cef752ce9114ebbced458f0853a01801ec3bf421119d7f9ab2a5779f146c70627c96463969c4aef9787a7fe3f4453f95f3aa3322c
7
+ data.tar.gz: e2f092bca43e6e24831733db7ed40b29e378bd29a49e04b10fd6a67ed1a1d6c4f0fef17bf3fa48b1fbdb75abe97b3c6ddc07ac7678b010132e5d8815f3f8b845
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ### 2.2.5 (2015-10-05)
4
+ - New: Now using viewport size to write svg dimensions. Some editors export SVG as 100% width and height, which is annoying if you want a set size.
5
+
3
6
  ### 2.2.5 (2015-10-02)
4
7
  - Fix: Javascript binding issue.
5
8
 
@@ -286,11 +286,13 @@ if(typeof(module) != 'undefined') { module.exports = esvg }
286
286
  end
287
287
 
288
288
  def dimensions(input)
289
- dimensions = []
290
- %w(viewBox height width).map do |dimension|
291
- dimensions << input.scan(/<svg.+(#{dimension}=["'].+?["'])/).flatten.first
292
- end
293
- dimensions.compact.join(' ')
289
+ dimension = input.scan(/<svg.+(viewBox=["'](.+?)["'])/).flatten
290
+ viewbox = dimension.first
291
+ coords = dimension.last.split(' ')
292
+
293
+ width = coords[2].to_i - coords[0].to_i
294
+ height = coords[3].to_i - coords[1].to_i
295
+ %Q{#{viewbox} width="#{width}" height="#{height}"}
294
296
  end
295
297
 
296
298
  def icon_name(name)
@@ -1,3 +1,3 @@
1
1
  module Esvg
2
- VERSION = "2.2.5"
2
+ VERSION = "2.3.0"
3
3
  end
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: 2.2.5
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-02 00:00:00.000000000 Z
11
+ date: 2015-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler