e_markerclusterer 0.0.2 → 0.0.3
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/CHANGELOG.md +9 -0
- data/README.md +1 -1
- data/lib/assets/javascripts/e_markerclusterer.js +50 -30
- data/lib/e_markerclusterer/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fda90d57a4418f76ff26c9062c126643a9b0b2a
|
4
|
+
data.tar.gz: c192acae32e08681c080c055b6c18a739ceb10af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2e1585009544d02f2caab1e3b372530fc900c65284dc45f872337048575d09f785afaac4281f320f3d156e59ca98ec761ddea30794193fa18002619096e35bd
|
7
|
+
data.tar.gz: 5b12bbce4bf719dab00c2e0204ea80d4ebb0940822c8978aa7d522a863d212f6aee581e44f794d76ec0b2f96a131e7402a9eb9c44266d04505d14a4632329eb6
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Note: This is in reverse chronological order, so newer entries are added to the top.
|
2
|
+
|
3
|
+
## Enhanced MarkerClusterer 0.0.3
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
* An element 'legendStyle' of opt_options to MarkerClusterer is added to set styles of legend box, which set several styles like position on Map, tag id, classes, and HTML CSS.
|
8
|
+
|
9
|
+
## Enhanced MarkerClusterer 0.0.2
|
data/README.md
CHANGED
@@ -119,5 +119,5 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
119
119
|
|
120
120
|
## Contributing
|
121
121
|
|
122
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
122
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sktivd/e_markerclusterer.
|
123
123
|
|
@@ -797,6 +797,8 @@ Cluster.prototype.isMarkerAlreadyAdded_ = function (marker) {
|
|
797
797
|
* An array of numbers containing the widths of the group of
|
798
798
|
* <code>imagePath</code>n.<code>imageExtension</code> image files.
|
799
799
|
* (The images are assumed to be square.)
|
800
|
+
* @property {Hash} {legendStyle=MarkerClusterer.LEGEND_STYLE}
|
801
|
+
* An hash of styles for legend of infographics.
|
800
802
|
*/
|
801
803
|
/**
|
802
804
|
* Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}.
|
@@ -852,6 +854,12 @@ function MarkerClusterer(map, opt_markers, opt_options) {
|
|
852
854
|
this.batchSize_ = opt_options.batchSize || MarkerClusterer.BATCH_SIZE;
|
853
855
|
this.batchSizeIE_ = opt_options.batchSizeIE || MarkerClusterer.BATCH_SIZE_IE;
|
854
856
|
this.clusterClass_ = opt_options.clusterClass || "cluster";
|
857
|
+
|
858
|
+
legendStyle = opt_options.legendStyle || {}
|
859
|
+
this.legendStyle_ = MarkerClusterer.LEGEND_STYLE;
|
860
|
+
for (var key in legendStyle) {
|
861
|
+
this.legendStyle_[key] = legendStyle[key];
|
862
|
+
}
|
855
863
|
|
856
864
|
if (navigator.userAgent.toLowerCase().indexOf("msie") !== -1) {
|
857
865
|
// Try to avoid IE timeout when processing a huge number of markers:
|
@@ -862,6 +870,9 @@ function MarkerClusterer(map, opt_markers, opt_options) {
|
|
862
870
|
|
863
871
|
this.addMarkers(opt_markers, true);
|
864
872
|
this.setMap(map); // Note: this causes onAdd to be called
|
873
|
+
|
874
|
+
// legend need getMap function to set a position of legend box
|
875
|
+
this.setupLegend_(opt_markers);
|
865
876
|
}
|
866
877
|
|
867
878
|
|
@@ -936,32 +947,6 @@ MarkerClusterer.prototype.onRemove = function () {
|
|
936
947
|
*/
|
937
948
|
MarkerClusterer.prototype.draw = function () {};
|
938
949
|
|
939
|
-
|
940
|
-
/**
|
941
|
-
* Sets up the styles object.
|
942
|
-
*/
|
943
|
-
/*
|
944
|
-
MarkerClusterer.prototype.setupStyles_ = function () {
|
945
|
-
var i, size;
|
946
|
-
var imagePath = [];
|
947
|
-
if (this.styles_.length > 0) {
|
948
|
-
return;
|
949
|
-
}
|
950
|
-
|
951
|
-
<% (0..5).each do |i| %>
|
952
|
-
imagePath.push("<%= image_path('m' + (i + 1).to_s + '.png') %>");
|
953
|
-
<% end %>
|
954
|
-
for (i = 0; i < this.imageSizes_.length; i++) {
|
955
|
-
size = this.imageSizes_[i];
|
956
|
-
this.styles_.push({
|
957
|
-
url: imagePath[i],
|
958
|
-
height: size,
|
959
|
-
width: size
|
960
|
-
});
|
961
|
-
}
|
962
|
-
}
|
963
|
-
*/
|
964
|
-
|
965
950
|
MarkerClusterer.prototype.setupStyles_ = function () {
|
966
951
|
var i, size;
|
967
952
|
var imagePath = [];
|
@@ -982,7 +967,6 @@ MarkerClusterer.prototype.setupStyles_ = function () {
|
|
982
967
|
/**
|
983
968
|
* Set up the legend of infographics
|
984
969
|
*/
|
985
|
-
|
986
970
|
MarkerClusterer.prototype.setupLegend_ = function (markers) {
|
987
971
|
var colorSeries = ["#3366cc", "#dc3912", "#ff9900", "#109618", "#990099", "#0099c6", "#dd4477", "#66aa00",
|
988
972
|
"#b82e2e", "#316395", "#994499", "#22aa99", "#aaaa11", "#6633cc", "#e67300", "#8b0707", "#651067",
|
@@ -1022,9 +1006,16 @@ MarkerClusterer.prototype.setupLegend_ = function (markers) {
|
|
1022
1006
|
}
|
1023
1007
|
}
|
1024
1008
|
|
1009
|
+
// set legend div block
|
1025
1010
|
var legend_div = document.createElement('div');
|
1026
|
-
|
1027
|
-
|
1011
|
+
if (this.legendStyle_.hasOwnProperty('id')) {
|
1012
|
+
legend_div.id = this.legendStyle_['id'];
|
1013
|
+
}
|
1014
|
+
if (this.legendStyle_.hasOwnProperty('class')) {
|
1015
|
+
legend_div.className = this.legendStyle_['class'];
|
1016
|
+
}
|
1017
|
+
legend_div.style.cssText = this.legendStyle_['css']
|
1018
|
+
this.getMap().controls[this.legendStyle_['position']].push(legend_div);
|
1028
1019
|
|
1029
1020
|
for (var title in this.legend_) {
|
1030
1021
|
var color = this.legend_[title];
|
@@ -1059,7 +1050,25 @@ MarkerClusterer.prototype.fitMapToMarkers = function () {
|
|
1059
1050
|
/**
|
1060
1051
|
* Returns the value of the <code>legend</code> property.
|
1061
1052
|
*
|
1062
|
-
* @return {
|
1053
|
+
* @return {Hash} The hash of styles for legend of infograpihcs.
|
1054
|
+
*/
|
1055
|
+
MarkerClusterer.prototype.getLegendSytle = function () {
|
1056
|
+
return this.legendStyle_;
|
1057
|
+
};
|
1058
|
+
|
1059
|
+
/**
|
1060
|
+
* Sets the value of the <code>legend</code> property.
|
1061
|
+
*
|
1062
|
+
* @param {Hash} {legendStyle} The hash of styles for legend of infographics.
|
1063
|
+
*/
|
1064
|
+
MarkerClusterer.prototype.setLegendStyle = function (legendStyle) {
|
1065
|
+
this.legendStyle_ = legendStyle;
|
1066
|
+
};
|
1067
|
+
|
1068
|
+
/**
|
1069
|
+
* Returns the value of the <code>legend</code> property.
|
1070
|
+
*
|
1071
|
+
* @return {Hash} The legend of infographics.
|
1063
1072
|
*/
|
1064
1073
|
MarkerClusterer.prototype.getLegend = function () {
|
1065
1074
|
return this.legend_;
|
@@ -1881,3 +1890,14 @@ MarkerClusterer.IMAGE_EXTENSION = "png";
|
|
1881
1890
|
* @constant
|
1882
1891
|
*/
|
1883
1892
|
MarkerClusterer.IMAGE_SIZES = [53, 56, 66, 78, 90];
|
1893
|
+
|
1894
|
+
/**
|
1895
|
+
* The default hash for the marker cluster legend.
|
1896
|
+
*
|
1897
|
+
* @type {Object.<string>}
|
1898
|
+
* @constant
|
1899
|
+
*/
|
1900
|
+
MarkerClusterer.LEGEND_STYLE = {
|
1901
|
+
css: 'margin-right: 5px; background-color: rgba(255, 255, 255, 0.5); padding: 10px; width: 123px',
|
1902
|
+
position: google.maps.ControlPosition.RIGHT_TOP
|
1903
|
+
};
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: e_markerclusterer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sung Gon Yi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -206,6 +206,7 @@ extra_rdoc_files: []
|
|
206
206
|
files:
|
207
207
|
- ".gitignore"
|
208
208
|
- ".travis.yml"
|
209
|
+
- CHANGELOG.md
|
209
210
|
- Gemfile
|
210
211
|
- Guardfile
|
211
212
|
- LICENSE
|