motion-imager 0.1.0 → 0.2.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 +21 -14
- data/lib/motion-imager/motion-imager.rb +27 -21
- data/lib/motion-imager/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfb8660e5b7e2923e6553d2d39c0243cb7cbc37d
|
4
|
+
data.tar.gz: 45f312075a01c0d77c184fc35fdb80ccfcf08fd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 230ab1063fd9a6ba1f9dc9aad9757d30a778e7f9f41794b0e30af5ebd3e238aad6f1a8a35226fa2ac31d609d36810f7cdcfe6f95921ffa7fd8282a8504e188c7
|
7
|
+
data.tar.gz: 965d37cd53748ca19469bfa55e2a92480da2b13afc053d91a9aabec68f74129b55a98040df00c0b2f0644152b091c41b15720990bd39683bd8d95abf0c29aace
|
data/README.md
CHANGED
@@ -1,20 +1,14 @@
|
|
1
1
|
# motion-imager
|
2
2
|
|
3
|
-
motion-imager is a RubyMotion DSL in top of [JTSImageViewController](https://github.com/jaredsinclair/JTSImageViewController) allowing you to easily create a "light-box" type view for users to view an image and interact with it.
|
3
|
+
motion-imager is a RubyMotion DSL in top of [JTSImageViewController](https://github.com/jaredsinclair/JTSImageViewController) by Jared Sinclair allowing you to easily create a "light-box" type view for users to view an image and interact with it.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'motion-imager'
|
10
|
-
|
11
|
-
And then execute:
|
5
|
+

|
12
6
|
|
13
|
-
|
14
|
-
|
15
|
-
Or install it yourself as:
|
7
|
+
## Installation
|
16
8
|
|
17
|
-
|
9
|
+
* Add `gem 'motion-imager'` to your gemfile
|
10
|
+
* run `bundle`
|
11
|
+
* run `rake pod:install`
|
18
12
|
|
19
13
|
## Usage
|
20
14
|
|
@@ -24,7 +18,7 @@ Using a UIImage:
|
|
24
18
|
MotionImager.new({
|
25
19
|
image: UIImage.imageNamed('something'),
|
26
20
|
presenting_from: WeakRef.new(self),
|
27
|
-
})
|
21
|
+
}).show
|
28
22
|
```
|
29
23
|
|
30
24
|
Using a URL:
|
@@ -35,7 +29,7 @@ MotionImager.new({
|
|
35
29
|
url: 'https://www.google.com/images/srpr/logo11w.png',
|
36
30
|
placeholder: 'my_placeholder_image',
|
37
31
|
presenting_from: WeakRef.new(self),
|
38
|
-
})
|
32
|
+
}).show
|
39
33
|
|
40
34
|
```
|
41
35
|
|
@@ -47,8 +41,21 @@ MotionImager.new({
|
|
47
41
|
transition: :original,
|
48
42
|
mode: :alt_text,
|
49
43
|
text: "This is a cool image",
|
44
|
+
}).show
|
45
|
+
|
46
|
+
```
|
47
|
+
|
48
|
+
Manually dismiss the lightbox:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
mi = MotionImager.new({
|
52
|
+
image: UIImage.imageNamed('something'),
|
53
|
+
presenting_from: WeakRef.new(self),
|
50
54
|
})
|
55
|
+
mi.show
|
51
56
|
|
57
|
+
# some time later:
|
58
|
+
mi.dismiss # mi.hide will work too!
|
52
59
|
```
|
53
60
|
|
54
61
|
Documentation for all available options:
|
@@ -1,38 +1,44 @@
|
|
1
1
|
class MotionImager
|
2
2
|
|
3
3
|
def initialize(args={})
|
4
|
-
|
4
|
+
@args = args
|
5
5
|
end
|
6
6
|
|
7
|
-
def show
|
8
|
-
controller
|
9
|
-
|
7
|
+
def show
|
8
|
+
@c = controller
|
9
|
+
@c.showFromViewController(@args[:presenting_from],
|
10
|
+
transition: transitions[@args[:transition]] || JTSImageViewControllerTransition_FromOriginalPosition
|
10
11
|
)
|
11
12
|
end
|
12
13
|
|
13
|
-
def
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
def hide(animated = true)
|
15
|
+
@c.dismiss(animated) if @c
|
16
|
+
end
|
17
|
+
alias :dismiss :hide
|
18
|
+
|
19
|
+
def controller
|
20
|
+
JTSImageViewController.alloc.initWithImageInfo(image_info,
|
21
|
+
mode: modes[@args[:mode]] || JTSImageViewControllerMode_Image,
|
22
|
+
backgroundStyle: backgrounds[@args[:background]] || JTSImageViewControllerBackgroundOption_Scaled
|
17
23
|
)
|
18
24
|
end
|
19
25
|
|
20
|
-
def image_info
|
26
|
+
def image_info
|
21
27
|
JTSImageInfo.new.tap do |i|
|
22
|
-
if args[:image]
|
23
|
-
args[:image] = UIImage.imageNamed(args[:image]) if args[:image].is_a?(String)
|
24
|
-
i.image = args[:image]
|
25
|
-
elsif args[:url]
|
26
|
-
args[:url] = NSURL.URLWithString(args[:url]) if args[:url].is_a?(String)
|
27
|
-
if args[:placeholder]
|
28
|
-
args[:placeholder] = UIImage.imageNamed(args[:placeholder]) if args[:placeholder].is_a?(String)
|
29
|
-
i.placeholderImage = args[:placeholder]
|
28
|
+
if @args[:image]
|
29
|
+
@args[:image] = UIImage.imageNamed(@args[:image]) if @args[:image].is_a?(String)
|
30
|
+
i.image = @args[:image]
|
31
|
+
elsif @args[:url]
|
32
|
+
@args[:url] = NSURL.URLWithString(@args[:url]) if @args[:url].is_a?(String)
|
33
|
+
if @args[:placeholder]
|
34
|
+
@args[:placeholder] = UIImage.imageNamed(@args[:placeholder]) if @args[:placeholder].is_a?(String)
|
35
|
+
i.placeholderImage = @args[:placeholder]
|
30
36
|
end
|
31
|
-
i.imageURL = args[:url]
|
37
|
+
i.imageURL = @args[:url]
|
32
38
|
end
|
33
|
-
i.altText = args[:text] if args[:text]
|
34
|
-
i.referenceRect = args[:rect] if args[:rect]
|
35
|
-
i.referenceView = args[:view] if args[:view]
|
39
|
+
i.altText = @args[:text] if @args[:text]
|
40
|
+
i.referenceRect = @args[:rect] if @args[:rect]
|
41
|
+
i.referenceView = @args[:view] if @args[:view]
|
36
42
|
end
|
37
43
|
end
|
38
44
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-imager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rickert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: motion-cocoapods
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ProMotion
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: 'An interactive iOS image viewer that does it all: double tap to zoom,
|
42
56
|
flick to dismiss, et cetera.'
|
43
57
|
email:
|