sugarcube 2.8.1 → 2.8.2

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: 9985bca73ff7087fee3be7621391ce74f9469d40
4
- data.tar.gz: cf072b49b9dd5d8d8372863dca69825ca6cd85cb
3
+ metadata.gz: 64d971eb3d120c7952f35581299baa11b8f05040
4
+ data.tar.gz: 1cd8be72a4aefac254d0b29d0250a942a7318297
5
5
  SHA512:
6
- metadata.gz: b4d920b6a983d8777da81443f4deaa308692bee99aad7018b173e6465880659ad173fe912574dedff7234088eb7578e93aa89167580e22febabb0062bd11a82b
7
- data.tar.gz: 5cd6ff676e184587abc2618f18459293715153baa5c516bc8b7e4256d9ac5be0e73d34967f26701678e2325a855af149cd708618e6767470ad521bef3c7301af
6
+ metadata.gz: a7fde608a38bfe81d70cdc61298af9feca8bf9f369f2d950746dbf123132cd2eb6baabf24834998269c56f6fd64963f4efc5fa796a60eb2bd8a18b5a90cc63a0
7
+ data.tar.gz: c1b0618b2e4be3d733b0f0436fc708383fa8ed0e4d2a632fbade2a16f31cd335c76c8a082921ba573fa555409131a251e5da5e9fc399eab300efabe978a78442
@@ -1,32 +1,41 @@
1
1
  class UIImage
2
2
  class << self
3
- SugarCube568_TallSuffix = '-568h@2x'
3
+ SugarCube568_TallSuffix = '-568h@2x' # 320 x 568
4
+ SugarCube667_TallSuffix = '-667h@2x' # 375 x 667
5
+ SugarCube736_TallSuffix = '-736h@2x' # 414 x 736
4
6
 
5
- def imageNamed568(name)
6
- @may_use_taller_images ||= CGSizeEqualToSize(CGSizeMake(320, 568), UIScreen.mainScreen.bounds.size)
7
- if ( @may_use_taller_images && name.length > 0 && name.rangeOfString(SugarCube568_TallSuffix).location == NSNotFound )
7
+ def sugarcube568_imageNamed(name)
8
+ case UIScreen.mainScreen.bounds.size.height
9
+ when 568
10
+ taller_image_ext = SugarCube568_TallSuffix
11
+ when 667
12
+ taller_image_ext = SugarCube667_TallSuffix
13
+ when 736
14
+ taller_image_ext = SugarCube736_TallSuffix
15
+ else
16
+ taller_image_ext = false
17
+ end
18
+
19
+ if ( taller_image_ext && name.length > 0 && name.rangeOfString(taller_image_ext).location == NSNotFound )
8
20
  # Check if is there a path extension or not
9
- test_name = name;
21
+ test_name = name
10
22
  if test_name.pathExtension.length > 0
11
- test_name = test_name.stringByDeletingPathExtension.stringByAppendingString(SugarCube568_TallSuffix).stringByAppendingPathExtension(name.pathExtension)
23
+ test_name = test_name.stringByDeletingPathExtension.stringByAppendingString(taller_image_ext).stringByAppendingPathExtension(name.pathExtension)
12
24
  else
13
- test_name = test_name.stringByAppendingString(SugarCube568_TallSuffix + ".png")
25
+ test_name = test_name.stringByAppendingString(taller_image_ext)
14
26
  end
15
27
 
16
- image = imageNamed_old(test_name)
17
- if image
18
- return self.imageWithCGImage(image.CGImage, scale:2.0, orientation:image.imageOrientation)
19
- end
28
+ return imageNamed_old(test_name)
20
29
  end
21
30
 
22
31
  return nil
23
32
  end
24
33
 
25
34
  alias :imageNamed_old :imageNamed
26
- # now we've got imageNamed568 and imageNamed_old to load the respective versions
35
+ # now we've got sugarcube568_imageNamed and imageNamed_old to load the respective versions
27
36
 
28
37
  def imageNamed(name)
29
- imageNamed568(name) || imageNamed_old(name)
38
+ sugarcube568_imageNamed(name) || imageNamed_old(name)
30
39
  end
31
40
  end
32
41
  end
@@ -30,12 +30,8 @@ class NSString
30
30
 
31
31
  # @return [NSImageView]
32
32
  def nsimageview
33
- image = NSImage.imageNamed(self)
34
- unless image
35
- NSLog("No image named #{self}")
36
- end
37
33
  image_view = NSImageView.alloc.init
38
- image_view.image = image
34
+ image_view.image = self.nsimage
39
35
  frame = image_view.frame
40
36
  frame.size = image_view.intrinsicContentSize
41
37
  image_view.frame = frame
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '2.8.1'
2
+ Version = '2.8.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarcube
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.1
4
+ version: 2.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin T.A. Gray
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-10-07 00:00:00.000000000 Z
14
+ date: 2014-10-08 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: |
17
17
  == Description