ProMotion-menu 1.0.0 → 1.1.0
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/README.md +24 -0
- data/lib/ProMotion-menu.rb +6 -0
- data/lib/ProMotion/menu/drawer.rb +6 -3
- data/lib/ProMotion/menu/transition.rb +48 -0
- data/lib/ProMotion/menu/version.rb +1 -1
- data/spec/drawer_spec.rb +8 -0
- data/spec/transition_spec.rb +40 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc35b7957b121ac2a05e893420f5ec279adff29a
|
4
|
+
data.tar.gz: 31fbd21f28e8cb617f9fc67e8b48fb132a5c174d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e9363a5b97e96c48f11c2189d1fb4bfe8159f1683bbbefc13ce2501726acf548d14fd9189f7fdca3358b893862da9bad77d0e4f8a164f452d5ad98d990b20db
|
7
|
+
data.tar.gz: 77a145ec8c9a57dc52dcd3efc9c35578f4063184a9c0cbb42ff30e06d4ca358105b8e7866c89e0dcf9ef72e50e23e8ec37e5fedc6325640020e8d72f5e672d03
|
data/README.md
CHANGED
@@ -62,6 +62,7 @@ class MenuDrawer < PM::Menu::Drawer
|
|
62
62
|
self.center = MyGreatAppScreen.new(nav_bar: true)
|
63
63
|
self.left = NavigationScreen
|
64
64
|
self.to_show = [:pan_bezel, :pan_nav_bar]
|
65
|
+
self.transition_animation = :swinging_door
|
65
66
|
self.max_left_width = 250
|
66
67
|
self.shadow = false
|
67
68
|
end
|
@@ -117,6 +118,29 @@ app_delegate.menu.to_show = :pan_center
|
|
117
118
|
|
118
119
|
```
|
119
120
|
|
121
|
+
## Transition Animation
|
122
|
+
Changing the transition animation is easy:
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
app_delegate.menu.transition_animation = :swinging_door
|
126
|
+
|
127
|
+
# The following transition animation options are available:
|
128
|
+
|
129
|
+
:slide # Default. Equivalent to :parallax_1 and similar to the menu
|
130
|
+
# in Spotify's app.
|
131
|
+
|
132
|
+
:slide_and_scale # A slide and scale visual effect similar to Mailbox.app.
|
133
|
+
# Scales from 90% to 100%, translates x 50px, and sets alpha
|
134
|
+
# from 0.0 to 1.0.
|
135
|
+
|
136
|
+
:swinging_door # A swinging door effect
|
137
|
+
|
138
|
+
:parallax_n # A parallax effect where n is a parallax factor.
|
139
|
+
:parallax # Equiavlent of :parallax_3
|
140
|
+
:parallax_1 # Equivalent of :slide
|
141
|
+
:"parallax_#{Float::MAX}" # Equivalent of no animation at all.
|
142
|
+
```
|
143
|
+
|
120
144
|
## Toggling the Menu Drawer Current Screen
|
121
145
|
To make the menu drawer present the menu from anywhere in your app:
|
122
146
|
|
data/lib/ProMotion-menu.rb
CHANGED
@@ -13,6 +13,12 @@ Motion::Project::App.setup do |app|
|
|
13
13
|
app.files.insert(insert_point, file)
|
14
14
|
end
|
15
15
|
|
16
|
+
# For compatibility with libraries that set detect_dependencies to false
|
17
|
+
app.files_dependencies({
|
18
|
+
"#{core_lib}/drawer.rb" => [ "#{core_lib}/visibility.rb", "#{core_lib}/gestures.rb" ],
|
19
|
+
"#{core_lib}/delegate.rb" => [ "#{core_lib}/drawer.rb" ],
|
20
|
+
})
|
21
|
+
|
16
22
|
app.pods do
|
17
23
|
pod 'MMDrawerController', '~> 0.5'
|
18
24
|
end
|
@@ -4,6 +4,7 @@ module ProMotion
|
|
4
4
|
include ::ProMotion::ScreenModule
|
5
5
|
include Gestures
|
6
6
|
include Visibility
|
7
|
+
include Transition
|
7
8
|
|
8
9
|
def self.new(center=nil, options={})
|
9
10
|
menu = alloc.init
|
@@ -75,9 +76,11 @@ module ProMotion
|
|
75
76
|
protected
|
76
77
|
|
77
78
|
def prepare_controller_for_pm(controller)
|
78
|
-
|
79
|
-
|
80
|
-
|
79
|
+
unless controller.nil?
|
80
|
+
controller = set_up_screen_for_open(controller, {})
|
81
|
+
ensure_wrapper_controller_in_place(controller, {})
|
82
|
+
controller.navigationController || controller
|
83
|
+
end
|
81
84
|
end
|
82
85
|
|
83
86
|
def default_completion_block
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module ProMotion; module Menu
|
2
|
+
module Transition
|
3
|
+
|
4
|
+
VISUAL_STATES = {
|
5
|
+
# Creates a slide and scale visual state block that gives an experience
|
6
|
+
# similar to Mailbox.app. It scales from 90% to 100%, and translates 50
|
7
|
+
# pixels in the x direction. In addition, it also sets alpha from 0.0 to 1.0.
|
8
|
+
slide_and_scale: MMDrawerVisualState.slideAndScaleVisualStateBlock,
|
9
|
+
|
10
|
+
# Creates a slide visual state block that gives the user an experience that
|
11
|
+
# slides at the same speed of the center view controller during animation.
|
12
|
+
# This is equal to calling parallaxVisualStateBlockWithParallaxFactor: with
|
13
|
+
# a parallax factor of 1.0. This is similar to the menu in Spotify's app.
|
14
|
+
slide: MMDrawerVisualState.slideVisualStateBlock,
|
15
|
+
|
16
|
+
# Creates a parallax experience that slides the side drawer view controller
|
17
|
+
# at a different rate than the center view controller during animation. For
|
18
|
+
# every parallaxFactor of points moved by the center view controller, the side
|
19
|
+
# drawer view controller will move 1 point. Passing in 1.0 is the equivalent
|
20
|
+
# of a applying a sliding animation, while passing in 'MAX_FLOAT' is the equivalent
|
21
|
+
# of having no animation at all.
|
22
|
+
parallax: MMDrawerVisualState.parallaxVisualStateBlockWithParallaxFactor(3),
|
23
|
+
|
24
|
+
# Creates a swinging door visual state block that gives the user an experience that
|
25
|
+
# animates the drawer in along the hinge.
|
26
|
+
swinging_door: MMDrawerVisualState.swingingDoorVisualStateBlock
|
27
|
+
}
|
28
|
+
|
29
|
+
def transition_animation=(visual_block)
|
30
|
+
# Parallax requires a parallax_factor. Set it by passing the visual_block
|
31
|
+
# block in with underscore parallax_factor attached to the end. i.e.
|
32
|
+
# transition_animation = :parallax_6 for parallax_factor 6.
|
33
|
+
self.setDrawerVisualStateBlock(mask_for_transition(visual_block))
|
34
|
+
end
|
35
|
+
|
36
|
+
def mask_for_transition(visual_block)
|
37
|
+
unless visual_block.nil?
|
38
|
+
if visual_block.include? "parallax"
|
39
|
+
parallax_factor = visual_block.include?("_") ? visual_block.split("_")[1].to_i : 3
|
40
|
+
visual_state = MMDrawerVisualState.parallaxVisualStateBlockWithParallaxFactor(parallax_factor)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
visual_state ||= VISUAL_STATES[visual_block]
|
44
|
+
visual_state
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end; end
|
data/spec/drawer_spec.rb
CHANGED
@@ -57,4 +57,12 @@ describe ProMotion::Menu::Drawer do
|
|
57
57
|
menu.showsShadow.should == true
|
58
58
|
end
|
59
59
|
|
60
|
+
it "doesn't crash if you set the left or right controller to nil" do
|
61
|
+
menu = ProMotion::Menu::Drawer.new(@content, left: nil, right: nil)
|
62
|
+
|
63
|
+
menu.left_controller.should == nil
|
64
|
+
menu.right_controller.should == nil
|
65
|
+
menu.center_controller.should == @content
|
66
|
+
end
|
67
|
+
|
60
68
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
describe ProMotion::Menu::Transition do
|
2
|
+
|
3
|
+
before do
|
4
|
+
@object = Object.new
|
5
|
+
@object.extend(ProMotion::Menu::Transition)
|
6
|
+
|
7
|
+
@delegate = UIApplication.sharedApplication.delegate
|
8
|
+
@left = LeftNavScreen.new
|
9
|
+
@right = RightNavScreen.new
|
10
|
+
@content = BlankScreen.new
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
describe "#visualStates" do
|
15
|
+
|
16
|
+
it "returns a visualStateBlock for slideAndScale" do
|
17
|
+
@object.mask_for_transition(:slide_and_scale).is_a?(Proc).should == true
|
18
|
+
end
|
19
|
+
|
20
|
+
it "returns a visualStateBlock for slide" do
|
21
|
+
@object.mask_for_transition(:slide).is_a?(Proc).should == true
|
22
|
+
end
|
23
|
+
|
24
|
+
it "returns a visualStateBlock for swingingDoor" do
|
25
|
+
@object.mask_for_transition(:slide_and_scale).is_a?(Proc).should == true
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns a visualStateBlock for parallax, when passing in a factor" do
|
29
|
+
@object.mask_for_transition(:parallax_5).is_a?(Proc).should == true
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns a visualStateBlock for parallax, default factor" do
|
33
|
+
@object.mask_for_transition(:parallax).is_a?(Proc).should == true
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ProMotion-menu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brewer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: motion-cocoapods
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/ProMotion/menu/delegate.rb
|
84
84
|
- lib/ProMotion/menu/drawer.rb
|
85
85
|
- lib/ProMotion/menu/gestures.rb
|
86
|
+
- lib/ProMotion/menu/transition.rb
|
86
87
|
- lib/ProMotion/menu/version.rb
|
87
88
|
- lib/ProMotion/menu/visibility.rb
|
88
89
|
- spec/app_delegate_spec.rb
|
@@ -91,6 +92,7 @@ files:
|
|
91
92
|
- spec/helpers/blank_screen.rb
|
92
93
|
- spec/helpers/left_nav_screen.rb
|
93
94
|
- spec/helpers/right_nav_screen.rb
|
95
|
+
- spec/transition_spec.rb
|
94
96
|
- spec/visibility_spec.rb
|
95
97
|
homepage: https://github.com/clearsightstudio/ProMotion-menu
|
96
98
|
licenses:
|
@@ -112,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
114
|
version: '0'
|
113
115
|
requirements: []
|
114
116
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.4.
|
117
|
+
rubygems_version: 2.4.5
|
116
118
|
signing_key:
|
117
119
|
specification_version: 4
|
118
120
|
summary: Provides a facebook/Path style slide menu for ProMotion RubyMotion apps.
|
@@ -123,4 +125,5 @@ test_files:
|
|
123
125
|
- spec/helpers/blank_screen.rb
|
124
126
|
- spec/helpers/left_nav_screen.rb
|
125
127
|
- spec/helpers/right_nav_screen.rb
|
128
|
+
- spec/transition_spec.rb
|
126
129
|
- spec/visibility_spec.rb
|