motion-kit 1.1.0 → 1.1.1

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: 7f25a8221661392838e777d1bc48bed110fd9857
4
- data.tar.gz: 17f939c142298c5b5744bf688c1e93dab9f46ab9
3
+ metadata.gz: 83fe321ba3c1652135459011ec16be84e16630ab
4
+ data.tar.gz: b36491239ecac26f6d59c198d0c5ec903075a084
5
5
  SHA512:
6
- metadata.gz: b8f8534aaad7966740767eace569905f5213feacdfec9756b199014acdefe7802eddf11d101bc58f4f821452a8dd49ea518c98cce6ea99e094a22096d63e3f48
7
- data.tar.gz: fc72309ba61213afd1040a94e8d392b4057ff64f8502128fe8165908f2a50fe93c91ffa55072802b8c1320c5d5799a6a7c05bca131a0ee7f5fc65d0486cc8a09
6
+ metadata.gz: 1d059ec845e5cacdf766d99223ebdd58ecd8ea591cc2ae2090de0dbcb2238b2f5cb1a5b0f7fa04d8c5fe9f74e542e55df97207d1d5eea23bf2c7a3980d97d72c
7
+ data.tar.gz: c8f31b25c8d1fc9224c8c4afe56b5f0a05a78fe7d3933fcae5ef8f2d93958681dc6295c5f2c9c2a45301c8ec62c44d412572fbcb039c022bc99be2589bbe2461
data/README.md CHANGED
@@ -220,7 +220,7 @@ def add_button style, button_title
220
220
  end
221
221
  ```
222
222
 
223
- During layout, z-order is determined by the sequence in which views are added to the hierarchy. You can control this dynamically by supplying :behind, :in_front_of, or :z_index options
223
+ During layout, z-order is determined by the sequence in which views are added to the hierarchy. You can control this dynamically by supplying :behind, :in_front_of, or :z_index options (:z_index not supported in OS X)
224
224
  ```ruby
225
225
  add UIImageView, :highlight_square, behind: get(:dynamic_button)
226
226
  add UIImageView, :x_marks_the_spot, in_front_of: @selected_label
@@ -9,7 +9,7 @@ module MotionKit
9
9
  self.class.targets.layer
10
10
  end
11
11
 
12
- def add_child(subview)
12
+ def add_child(subview, options={})
13
13
  target.addSublayer(subview)
14
14
  end
15
15
 
@@ -16,7 +16,7 @@ module MotionKit
16
16
  menu_class.alloc.init
17
17
  end
18
18
 
19
- def add_child(submenu)
19
+ def add_child(submenu, options={})
20
20
  target.addItem(submenu)
21
21
  end
22
22
 
@@ -11,8 +11,16 @@ module MotionKit
11
11
  view_class.alloc.initWithFrame([[0, 0], [0, 0]])
12
12
  end
13
13
 
14
- def add_child(subview)
15
- target.addSubview(subview)
14
+ def add_child(subview, options={})
15
+ if (sibling = options[:behind])
16
+ target.addSubview(subview, positioned: NSWindowBelow, relativeTo: sibling)
17
+ elsif (sibling = options[:in_front_of])
18
+ target.addSubview(subview, positioned: NSWindowAbove, relativeTo: sibling)
19
+ elsif (z_index = options[:z_index])
20
+ NSLog('Warning! :z_index option not supported in OS X when adding a child view')
21
+ else
22
+ target.addSubview(subview)
23
+ end
16
24
  end
17
25
 
18
26
  def remove_child(subview)
@@ -19,8 +19,16 @@ module MotionKit
19
19
  defer: false)
20
20
  end
21
21
 
22
- def add_child(subview)
23
- target.contentView.addSubview(subview)
22
+ def add_child(subview, options={})
23
+ if (sibling = options[:behind])
24
+ target.contentView.addSubview(subview, positioned: NSWindowBelow, relativeTo: sibling)
25
+ elsif (sibling = options[:in_front_of])
26
+ target.contentView.addSubview(subview, positioned: NSWindowAbove, relativeTo: sibling)
27
+ elsif (z_index = options[:z_index])
28
+ NSLog('Warning! :z_index option not supported in OS X when adding a child view')
29
+ else
30
+ target.contentView.addSubview(subview)
31
+ end
24
32
  end
25
33
 
26
34
  def remove_child(subview)
@@ -11,8 +11,16 @@ module MotionKit
11
11
  view_class.alloc.initWithFrame(UIScreen.mainScreen.applicationFrame)
12
12
  end
13
13
 
14
- def add_child(subview)
15
- target.addSubview(subview)
14
+ def add_child(subview, options={})
15
+ if (sibling = options[:behind])
16
+ target.insertSubview(subview, belowSubview: sibling)
17
+ elsif (sibling = options[:in_front_of])
18
+ target.insertSubview(subview, aboveSubview: sibling)
19
+ elsif (z_index = options[:z_index])
20
+ target.insertSubview(subview, atIndex: z_index)
21
+ else
22
+ target.addSubview(subview)
23
+ end
16
24
  end
17
25
 
18
26
  def remove_child(subview)
@@ -1,3 +1,3 @@
1
1
  module MotionKit
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin T.A. Gray