leaflet-zoomfs-rails 0.5.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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in leaflet-zoomfs-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Klaas Endrikat
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Leaflet::Zoomfs::Rails
2
+
3
+ Integrates the [Leaflet ZoomFS] plugin with Rails asset pipeline
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'leaflet-zoomfs-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install leaflet-zoomfs-rails
18
+
19
+ ## Usage
20
+
21
+ Add the following to your `app/assets/javascripts/application.js`:
22
+
23
+ //= require leaflet.zoomfs
24
+
25
+ Examples can be found at [elidupuis]
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
34
+
35
+ ## License
36
+ MIT License, full text of license see [here][License]
37
+
38
+ *Free Software, Fuck Yeah!*
39
+
40
+ [License]: https://github.com/kendrikat/leaflet-zoomfs-rails/blob/master/LICENSE.txt "LICENSE"
41
+ [Leaflet ZoomFS]: https://github.com/elidupuis/leaflet.zoomfs
42
+ [elidupuis]: https://github.com/elidupuis/leaflet.zoomfs
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'leaflet-zoomfs-rails/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "leaflet-zoomfs-rails"
8
+ gem.version = Leaflet::Zoomfs::Rails::VERSION
9
+ gem.authors = ["Klaas Endrikat"]
10
+ gem.email = ["klaas.endrikat@googlemail.com"]
11
+ gem.description = %q{Integrates the Leaflet ZoomFS plugin with Rails asset pipeline}
12
+ gem.summary = %q{Leaflet ZoomFS plugin for Rails}
13
+ gem.license = 'MIT'
14
+ gem.homepage = "https://github.com/kendrikat/leaflet-zoomfs-rails"
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+ end
@@ -0,0 +1,7 @@
1
+ module Leaflet
2
+ module Zoomfs
3
+ module Rails
4
+ VERSION = "0.5.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require "leaflet-zoomfs-rails/version"
2
+
3
+ module Leaflet
4
+ module Zoomfs
5
+ module Rails
6
+ class Engine < ::Rails::Engine
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,103 @@
1
+ /*
2
+ * L.Control.ZoomFS - default Leaflet.Zoom control with an added fullscreen button
3
+ * built to work with Leaflet version 0.5
4
+ * https://github.com/elidupuis/leaflet.zoomfs
5
+ */
6
+ L.Control.ZoomFS = L.Control.Zoom.extend({
7
+ options: {
8
+ onlyfs: false
9
+ },
10
+ includes: L.Mixin.Events,
11
+ onAdd: function (map) {
12
+ var zoomName = 'leaflet-control-zoom',
13
+ barName = 'leaflet-bar',
14
+ partName = barName + '-part',
15
+ container = L.DomUtil.create('div', zoomName + ' ' + barName);
16
+
17
+ this._map = map;
18
+ this._isFullscreen = false;
19
+
20
+ this._zoomFullScreenButton = this._createButton('','Full Screen',
21
+ 'leaflet-control-fullscreen ' +
22
+ partName + ' ' +
23
+ partName + '-top',
24
+ container, this.fullscreen, this);
25
+
26
+ if (!this.options.onlyfs) {
27
+ this._zoomInButton = this._createButton('+', 'Zoom in',
28
+ zoomName + '-in ' +
29
+ partName + ' ',
30
+ container, this._zoomIn, this);
31
+
32
+ this._zoomOutButton = this._createButton('-', 'Zoom out',
33
+ zoomName + '-out ' +
34
+ partName + ' ' +
35
+ partName + '-bottom',
36
+ container, this._zoomOut, this);
37
+ }
38
+
39
+ map.on('zoomend zoomlevelschange', this._updateDisabled, this);
40
+
41
+ return container;
42
+
43
+ },
44
+ fullscreen: function() {
45
+ // call appropriate internal function
46
+ if (!this._isFullscreen) {
47
+ this._enterFullScreen();
48
+ } else {
49
+ this._exitFullScreen();
50
+ }
51
+
52
+ // force internal resize
53
+ this._map.invalidateSize();
54
+ },
55
+ _enterFullScreen: function() {
56
+ var container = this._map._container;
57
+
58
+ // apply our fullscreen settings
59
+ container.style.position = 'fixed';
60
+ container.style.left = 0;
61
+ container.style.top = 0;
62
+ container.style.width = '100%';
63
+ container.style.height = '100%';
64
+
65
+ // store state
66
+ L.DomUtil.addClass(container, 'leaflet-fullscreen');
67
+ this._isFullscreen = true;
68
+
69
+ // add ESC listener
70
+ L.DomEvent.addListener(document, 'keyup', this._onKeyUp, this);
71
+
72
+ // fire fullscreen event on map
73
+ this._map.fire('enterFullscreen');
74
+ },
75
+ _exitFullScreen: function() {
76
+ var container = this._map._container;
77
+
78
+ // update state
79
+ L.DomUtil.removeClass(container, 'leaflet-fullscreen');
80
+ this._isFullscreen = false;
81
+
82
+ // remove fullscreen style; make sure we're still position relative for Leaflet core.
83
+ container.removeAttribute('style');
84
+
85
+ // re-apply position:relative; if user does not have it.
86
+ var position = L.DomUtil.getStyle(container, 'position');
87
+ if (position !== 'absolute' && position !== 'relative') {
88
+ container.style.position = 'relative';
89
+ }
90
+
91
+ // remove ESC listener
92
+ L.DomEvent.removeListener(document, 'keyup', this._onKeyUp);
93
+
94
+ // fire fullscreen event
95
+ this._map.fire('exitFullscreen');
96
+ },
97
+ _onKeyUp: function(e) {
98
+ if (!e) e = window.event;
99
+ if (e.keyCode === 27 && this._isFullscreen === true) {
100
+ this._exitFullScreen();
101
+ }
102
+ }
103
+ });
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: leaflet-zoomfs-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Klaas Endrikat
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-24 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Integrates the Leaflet ZoomFS plugin with Rails asset pipeline
15
+ email:
16
+ - klaas.endrikat@googlemail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - leaflet-zoomfs-rails.gemspec
27
+ - lib/leaflet-zoomfs-rails.rb
28
+ - lib/leaflet-zoomfs-rails/version.rb
29
+ - vendor/assets/javascripts/leaflet.zoomfs.js
30
+ homepage: https://github.com/kendrikat/leaflet-zoomfs-rails
31
+ licenses:
32
+ - MIT
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubyforge_project:
51
+ rubygems_version: 1.8.24
52
+ signing_key:
53
+ specification_version: 3
54
+ summary: Leaflet ZoomFS plugin for Rails
55
+ test_files: []