gmapz 2.0.9 → 2.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -4
- data/lib/gmapz/version.rb +1 -1
- data/src/js/gmapz-dependencies/infobox.modified.js +844 -0
- data/src/js/gmapz/gmapz.js +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d04c1e0e53b4cc853fad0a95142657f3b1cc982
|
4
|
+
data.tar.gz: 8375bfc2f1b027264fc667fee98057952f4e62b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8e0c7420a77c3de333c341445bb57429805f395f1f2bd994f4dbc8884ab9b97ad01f414a7591c90f0c5304ea41b4e1189ab869b90363ed50d315c12f23aba39
|
7
|
+
data.tar.gz: c64c9e92dfdef30925dcf1e4cce15560a383bb1fdc56236dd95d4bfede843164881598f1c2a0838d86d8e8b3903a46e742d008adde8e479455501bdfdbd07e4e
|
data/README.md
CHANGED
@@ -1,12 +1,9 @@
|
|
1
|
-
# GMapz v2.
|
1
|
+
# GMapz v2.10
|
2
2
|
|
3
3
|
GMapz is yet another Google Maps JS library. It eases the creation of Google Maps, it's **responsive**, supports the creation of **multiple instances in the same page** (each one with its own settings), the creation of **custom styled infowindows**, and other useful helpers.
|
4
4
|
<br><br>
|
5
5
|
You can view the full documentation (WIP) and working samples at:<br>
|
6
6
|
**[http://carloscabo.github.io/gmapz](http://carloscabo.github.io/gmapz)**
|
7
|
-
<br><br>
|
8
|
-
There is Rails Gem version available ( thx! [@dreamingechoes](https://github.com/dreamingechoes) ):
|
9
|
-
**[https://rubygems.org/gems/gmapz_rails](https://rubygems.org/gems/gmapz_rails)**
|
10
7
|
|
11
8
|
# Installation
|
12
9
|
|
@@ -49,6 +46,8 @@ If you want to customize the map **infobox windows** you can use `src/css/gmapz-
|
|
49
46
|
|
50
47
|
# Changelog
|
51
48
|
|
49
|
+
- 2.10 (2017/04/19)
|
50
|
+
* Rails Gem
|
52
51
|
- 2.09 (2016/07/15)
|
53
52
|
* Rails Gem
|
54
53
|
- 2.08 (2016/07/06)
|
data/lib/gmapz/version.rb
CHANGED
@@ -0,0 +1,844 @@
|
|
1
|
+
/**
|
2
|
+
* @name InfoBox
|
3
|
+
* @version 1.1.13 [March 19, 2014]
|
4
|
+
* @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google)
|
5
|
+
* @copyright Copyright 2010 Gary Little [gary at luxcentral.com]
|
6
|
+
* @fileoverview InfoBox extends the Google Maps JavaScript API V3 <tt>OverlayView</tt> class.
|
7
|
+
* <p>
|
8
|
+
* An InfoBox behaves like a <tt>google.maps.InfoWindow</tt>, but it supports several
|
9
|
+
* additional properties for advanced styling. An InfoBox can also be used as a map label.
|
10
|
+
* <p>
|
11
|
+
* An InfoBox also fires the same events as a <tt>google.maps.InfoWindow</tt>.
|
12
|
+
*/
|
13
|
+
|
14
|
+
/*!
|
15
|
+
*
|
16
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
17
|
+
* you may not use this file except in compliance with the License.
|
18
|
+
* You may obtain a copy of the License at
|
19
|
+
*
|
20
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
21
|
+
*
|
22
|
+
* Unless required by applicable law or agreed to in writing, software
|
23
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
24
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
25
|
+
* See the License for the specific language governing permissions and
|
26
|
+
* limitations under the License.
|
27
|
+
*/
|
28
|
+
|
29
|
+
/*jslint browser:true */
|
30
|
+
/*global google */
|
31
|
+
|
32
|
+
/**
|
33
|
+
* @name InfoBoxOptions
|
34
|
+
* @class This class represents the optional parameter passed to the {@link InfoBox} constructor.
|
35
|
+
* @property {string|Node} content The content of the InfoBox (plain text or an HTML DOM node).
|
36
|
+
* @property {boolean} [disableAutoPan=false] Disable auto-pan on <tt>open</tt>.
|
37
|
+
* @property {number} maxWidth The maximum width (in pixels) of the InfoBox. Set to 0 if no maximum.
|
38
|
+
* @property {Size} pixelOffset The offset (in pixels) from the top left corner of the InfoBox
|
39
|
+
* (or the bottom left corner if the <code>alignBottom</code> property is <code>true</code>)
|
40
|
+
* to the map pixel corresponding to <tt>position</tt>.
|
41
|
+
* @property {LatLng} position The geographic location at which to display the InfoBox.
|
42
|
+
* @property {number} zIndex The CSS z-index style value for the InfoBox.
|
43
|
+
* Note: This value overrides a zIndex setting specified in the <tt>boxStyle</tt> property.
|
44
|
+
* @property {string} [boxClass="infoBox"] The name of the CSS class defining the styles for the InfoBox container.
|
45
|
+
* @property {Object} [boxStyle] An object literal whose properties define specific CSS
|
46
|
+
* style values to be applied to the InfoBox. Style values defined here override those that may
|
47
|
+
* be defined in the <code>boxClass</code> style sheet. If this property is changed after the
|
48
|
+
* InfoBox has been created, all previously set styles (except those defined in the style sheet)
|
49
|
+
* are removed from the InfoBox before the new style values are applied.
|
50
|
+
* @property {string} closeBoxMargin The CSS margin style value for the close box.
|
51
|
+
* The default is "2px" (a 2-pixel margin on all sides).
|
52
|
+
* @property {string} closeBoxURL The URL of the image representing the close box.
|
53
|
+
* Note: The default is the URL for Google's standard close box.
|
54
|
+
* Set this property to "" if no close box is required.
|
55
|
+
* @property {Size} infoBoxClearance Minimum offset (in pixels) from the InfoBox to the
|
56
|
+
* map edge after an auto-pan.
|
57
|
+
* @property {boolean} [isHidden=false] Hide the InfoBox on <tt>open</tt>.
|
58
|
+
* [Deprecated in favor of the <tt>visible</tt> property.]
|
59
|
+
* @property {boolean} [visible=true] Show the InfoBox on <tt>open</tt>.
|
60
|
+
* @property {boolean} alignBottom Align the bottom left corner of the InfoBox to the <code>position</code>
|
61
|
+
* location (default is <tt>false</tt> which means that the top left corner of the InfoBox is aligned).
|
62
|
+
* @property {string} pane The pane where the InfoBox is to appear (default is "floatPane").
|
63
|
+
* Set the pane to "mapPane" if the InfoBox is being used as a map label.
|
64
|
+
* Valid pane names are the property names for the <tt>google.maps.MapPanes</tt> object.
|
65
|
+
* @property {boolean} enableEventPropagation Propagate mousedown, mousemove, mouseover, mouseout,
|
66
|
+
* mouseup, click, dblclick, touchstart, touchend, touchmove, and contextmenu events in the InfoBox
|
67
|
+
* (default is <tt>false</tt> to mimic the behavior of a <tt>google.maps.InfoWindow</tt>). Set
|
68
|
+
* this property to <tt>true</tt> if the InfoBox is being used as a map label.
|
69
|
+
*/
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Creates an InfoBox with the options specified in {@link InfoBoxOptions}.
|
73
|
+
* Call <tt>InfoBox.open</tt> to add the box to the map.
|
74
|
+
* @constructor
|
75
|
+
* @param {InfoBoxOptions} [opt_opts]
|
76
|
+
*/
|
77
|
+
|
78
|
+
/*
|
79
|
+
* A closure was added to avoid having references to google.maps BEFORE was
|
80
|
+
* loaded, was was causing error on JS loading...
|
81
|
+
*/
|
82
|
+
|
83
|
+
(function(window, undefined) {
|
84
|
+
var google_maps_loaded = false;
|
85
|
+
function init(google_maps_loaded) {
|
86
|
+
if (google_maps_loaded) {
|
87
|
+
|
88
|
+
/**
|
89
|
+
* BEGIN OF ORIGINAL infobox.js v v v v v v v v v v v v v v v v v v v v v v
|
90
|
+
*/
|
91
|
+
|
92
|
+
function InfoBox(opt_opts) {
|
93
|
+
|
94
|
+
opt_opts = opt_opts || {};
|
95
|
+
|
96
|
+
google.maps.OverlayView.apply(this, arguments);
|
97
|
+
|
98
|
+
// Standard options (in common with google.maps.InfoWindow):
|
99
|
+
//
|
100
|
+
this.content_ = opt_opts.content || "";
|
101
|
+
this.disableAutoPan_ = opt_opts.disableAutoPan || false;
|
102
|
+
this.maxWidth_ = opt_opts.maxWidth || 0;
|
103
|
+
this.pixelOffset_ = opt_opts.pixelOffset || new google.maps.Size(0, 0);
|
104
|
+
this.position_ = opt_opts.position || new google.maps.LatLng(0, 0);
|
105
|
+
this.zIndex_ = opt_opts.zIndex || null;
|
106
|
+
|
107
|
+
// Additional options (unique to InfoBox):
|
108
|
+
//
|
109
|
+
this.boxClass_ = opt_opts.boxClass || "infoBox";
|
110
|
+
this.boxStyle_ = opt_opts.boxStyle || {};
|
111
|
+
this.closeBoxMargin_ = opt_opts.closeBoxMargin || "2px";
|
112
|
+
this.closeBoxURL_ = opt_opts.closeBoxURL || "http://www.google.com/intl/en_us/mapfiles/close.gif";
|
113
|
+
if (opt_opts.closeBoxURL === "") {
|
114
|
+
this.closeBoxURL_ = "";
|
115
|
+
}
|
116
|
+
this.infoBoxClearance_ = opt_opts.infoBoxClearance || new google.maps.Size(1, 1);
|
117
|
+
|
118
|
+
if (typeof opt_opts.visible === "undefined") {
|
119
|
+
if (typeof opt_opts.isHidden === "undefined") {
|
120
|
+
opt_opts.visible = true;
|
121
|
+
} else {
|
122
|
+
opt_opts.visible = !opt_opts.isHidden;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
this.isHidden_ = !opt_opts.visible;
|
126
|
+
|
127
|
+
this.alignBottom_ = opt_opts.alignBottom || false;
|
128
|
+
this.pane_ = opt_opts.pane || "floatPane";
|
129
|
+
this.enableEventPropagation_ = opt_opts.enableEventPropagation || false;
|
130
|
+
|
131
|
+
this.div_ = null;
|
132
|
+
this.closeListener_ = null;
|
133
|
+
this.moveListener_ = null;
|
134
|
+
this.contextListener_ = null;
|
135
|
+
this.eventListeners_ = null;
|
136
|
+
this.fixedWidthSet_ = null;
|
137
|
+
}
|
138
|
+
|
139
|
+
/* InfoBox extends OverlayView in the Google Maps API v3.
|
140
|
+
*/
|
141
|
+
InfoBox.prototype = new google.maps.OverlayView();
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Creates the DIV representing the InfoBox.
|
145
|
+
* @private
|
146
|
+
*/
|
147
|
+
InfoBox.prototype.createInfoBoxDiv_ = function () {
|
148
|
+
|
149
|
+
var i;
|
150
|
+
var events;
|
151
|
+
var bw;
|
152
|
+
var me = this;
|
153
|
+
|
154
|
+
// This handler prevents an event in the InfoBox from being passed on to the map.
|
155
|
+
//
|
156
|
+
var cancelHandler = function (e) {
|
157
|
+
e.cancelBubble = true;
|
158
|
+
if (e.stopPropagation) {
|
159
|
+
e.stopPropagation();
|
160
|
+
}
|
161
|
+
};
|
162
|
+
|
163
|
+
// This handler ignores the current event in the InfoBox and conditionally prevents
|
164
|
+
// the event from being passed on to the map. It is used for the contextmenu event.
|
165
|
+
//
|
166
|
+
var ignoreHandler = function (e) {
|
167
|
+
|
168
|
+
e.returnValue = false;
|
169
|
+
|
170
|
+
if (e.preventDefault) {
|
171
|
+
|
172
|
+
e.preventDefault();
|
173
|
+
}
|
174
|
+
|
175
|
+
if (!me.enableEventPropagation_) {
|
176
|
+
|
177
|
+
cancelHandler(e);
|
178
|
+
}
|
179
|
+
};
|
180
|
+
|
181
|
+
if (!this.div_) {
|
182
|
+
|
183
|
+
this.div_ = document.createElement("div");
|
184
|
+
|
185
|
+
this.setBoxStyle_();
|
186
|
+
|
187
|
+
if (typeof this.content_.nodeType === "undefined") {
|
188
|
+
this.div_.innerHTML = this.getCloseBoxImg_() + this.content_;
|
189
|
+
} else {
|
190
|
+
this.div_.innerHTML = this.getCloseBoxImg_();
|
191
|
+
this.div_.appendChild(this.content_);
|
192
|
+
}
|
193
|
+
|
194
|
+
// Add the InfoBox DIV to the DOM
|
195
|
+
this.getPanes()[this.pane_].appendChild(this.div_);
|
196
|
+
|
197
|
+
this.addClickHandler_();
|
198
|
+
|
199
|
+
if (this.div_.style.width) {
|
200
|
+
|
201
|
+
this.fixedWidthSet_ = true;
|
202
|
+
|
203
|
+
} else {
|
204
|
+
|
205
|
+
if (this.maxWidth_ !== 0 && this.div_.offsetWidth > this.maxWidth_) {
|
206
|
+
|
207
|
+
this.div_.style.width = this.maxWidth_;
|
208
|
+
this.div_.style.overflow = "auto";
|
209
|
+
this.fixedWidthSet_ = true;
|
210
|
+
|
211
|
+
} else { // The following code is needed to overcome problems with MSIE
|
212
|
+
|
213
|
+
bw = this.getBoxWidths_();
|
214
|
+
|
215
|
+
this.div_.style.width = (this.div_.offsetWidth - bw.left - bw.right) + "px";
|
216
|
+
this.fixedWidthSet_ = false;
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
220
|
+
this.panBox_(this.disableAutoPan_);
|
221
|
+
|
222
|
+
if (!this.enableEventPropagation_) {
|
223
|
+
|
224
|
+
this.eventListeners_ = [];
|
225
|
+
|
226
|
+
// Cancel event propagation.
|
227
|
+
//
|
228
|
+
// Note: mousemove not included (to resolve Issue 152)
|
229
|
+
events = ["mousedown", "mouseover", "mouseout", "mouseup",
|
230
|
+
"click", "dblclick", "touchstart", "touchend", "touchmove"];
|
231
|
+
|
232
|
+
for (i = 0; i < events.length; i++) {
|
233
|
+
|
234
|
+
this.eventListeners_.push(google.maps.event.addDomListener(this.div_, events[i], cancelHandler));
|
235
|
+
}
|
236
|
+
|
237
|
+
// Workaround for Google bug that causes the cursor to change to a pointer
|
238
|
+
// when the mouse moves over a marker underneath InfoBox.
|
239
|
+
this.eventListeners_.push(google.maps.event.addDomListener(this.div_, "mouseover", function (e) {
|
240
|
+
this.style.cursor = "default";
|
241
|
+
}));
|
242
|
+
}
|
243
|
+
|
244
|
+
this.contextListener_ = google.maps.event.addDomListener(this.div_, "contextmenu", ignoreHandler);
|
245
|
+
|
246
|
+
/**
|
247
|
+
* This event is fired when the DIV containing the InfoBox's content is attached to the DOM.
|
248
|
+
* @name InfoBox#domready
|
249
|
+
* @event
|
250
|
+
*/
|
251
|
+
google.maps.event.trigger(this, "domready");
|
252
|
+
}
|
253
|
+
};
|
254
|
+
|
255
|
+
/**
|
256
|
+
* Returns the HTML <IMG> tag for the close box.
|
257
|
+
* @private
|
258
|
+
*/
|
259
|
+
InfoBox.prototype.getCloseBoxImg_ = function () {
|
260
|
+
|
261
|
+
var img = "";
|
262
|
+
|
263
|
+
if (this.closeBoxURL_ !== "") {
|
264
|
+
|
265
|
+
img = "<img";
|
266
|
+
img += " src='" + this.closeBoxURL_ + "'";
|
267
|
+
img += " align=right"; // Do this because Opera chokes on style='float: right;'
|
268
|
+
img += " style='";
|
269
|
+
img += " position: relative;"; // Required by MSIE
|
270
|
+
img += " cursor: pointer;";
|
271
|
+
img += " margin: " + this.closeBoxMargin_ + ";";
|
272
|
+
img += "'>";
|
273
|
+
}
|
274
|
+
|
275
|
+
return img;
|
276
|
+
};
|
277
|
+
|
278
|
+
/**
|
279
|
+
* Adds the click handler to the InfoBox close box.
|
280
|
+
* @private
|
281
|
+
*/
|
282
|
+
InfoBox.prototype.addClickHandler_ = function () {
|
283
|
+
|
284
|
+
var closeBox;
|
285
|
+
|
286
|
+
if (this.closeBoxURL_ !== "") {
|
287
|
+
|
288
|
+
closeBox = this.div_.firstChild;
|
289
|
+
this.closeListener_ = google.maps.event.addDomListener(closeBox, "click", this.getCloseClickHandler_());
|
290
|
+
|
291
|
+
} else {
|
292
|
+
|
293
|
+
this.closeListener_ = null;
|
294
|
+
}
|
295
|
+
};
|
296
|
+
|
297
|
+
/**
|
298
|
+
* Returns the function to call when the user clicks the close box of an InfoBox.
|
299
|
+
* @private
|
300
|
+
*/
|
301
|
+
InfoBox.prototype.getCloseClickHandler_ = function () {
|
302
|
+
|
303
|
+
var me = this;
|
304
|
+
|
305
|
+
return function (e) {
|
306
|
+
|
307
|
+
// 1.0.3 fix: Always prevent propagation of a close box click to the map:
|
308
|
+
e.cancelBubble = true;
|
309
|
+
|
310
|
+
if (e.stopPropagation) {
|
311
|
+
|
312
|
+
e.stopPropagation();
|
313
|
+
}
|
314
|
+
|
315
|
+
/**
|
316
|
+
* This event is fired when the InfoBox's close box is clicked.
|
317
|
+
* @name InfoBox#closeclick
|
318
|
+
* @event
|
319
|
+
*/
|
320
|
+
google.maps.event.trigger(me, "closeclick");
|
321
|
+
|
322
|
+
me.close();
|
323
|
+
};
|
324
|
+
};
|
325
|
+
|
326
|
+
/**
|
327
|
+
* Pans the map so that the InfoBox appears entirely within the map's visible area.
|
328
|
+
* @private
|
329
|
+
*/
|
330
|
+
InfoBox.prototype.panBox_ = function (disablePan) {
|
331
|
+
|
332
|
+
var map;
|
333
|
+
var bounds;
|
334
|
+
var xOffset = 0, yOffset = 0;
|
335
|
+
|
336
|
+
if (!disablePan) {
|
337
|
+
|
338
|
+
map = this.getMap();
|
339
|
+
|
340
|
+
if (map instanceof google.maps.Map) { // Only pan if attached to map, not panorama
|
341
|
+
|
342
|
+
if (!map.getBounds().contains(this.position_)) {
|
343
|
+
// Marker not in visible area of map, so set center
|
344
|
+
// of map to the marker position first.
|
345
|
+
map.setCenter(this.position_);
|
346
|
+
}
|
347
|
+
|
348
|
+
bounds = map.getBounds();
|
349
|
+
|
350
|
+
var mapDiv = map.getDiv();
|
351
|
+
var mapWidth = mapDiv.offsetWidth;
|
352
|
+
var mapHeight = mapDiv.offsetHeight;
|
353
|
+
var iwOffsetX = this.pixelOffset_.width;
|
354
|
+
var iwOffsetY = this.pixelOffset_.height;
|
355
|
+
var iwWidth = this.div_.offsetWidth;
|
356
|
+
var iwHeight = this.div_.offsetHeight;
|
357
|
+
var padX = this.infoBoxClearance_.width;
|
358
|
+
var padY = this.infoBoxClearance_.height;
|
359
|
+
var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.position_);
|
360
|
+
|
361
|
+
if (pixPosition.x < (-iwOffsetX + padX)) {
|
362
|
+
xOffset = pixPosition.x + iwOffsetX - padX;
|
363
|
+
} else if ((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth) {
|
364
|
+
xOffset = pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth;
|
365
|
+
}
|
366
|
+
if (this.alignBottom_) {
|
367
|
+
if (pixPosition.y < (-iwOffsetY + padY + iwHeight)) {
|
368
|
+
yOffset = pixPosition.y + iwOffsetY - padY - iwHeight;
|
369
|
+
} else if ((pixPosition.y + iwOffsetY + padY) > mapHeight) {
|
370
|
+
yOffset = pixPosition.y + iwOffsetY + padY - mapHeight;
|
371
|
+
}
|
372
|
+
} else {
|
373
|
+
if (pixPosition.y < (-iwOffsetY + padY)) {
|
374
|
+
yOffset = pixPosition.y + iwOffsetY - padY;
|
375
|
+
} else if ((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight) {
|
376
|
+
yOffset = pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight;
|
377
|
+
}
|
378
|
+
}
|
379
|
+
|
380
|
+
if (!(xOffset === 0 && yOffset === 0)) {
|
381
|
+
|
382
|
+
// Move the map to the shifted center.
|
383
|
+
//
|
384
|
+
var c = map.getCenter();
|
385
|
+
map.panBy(xOffset, yOffset);
|
386
|
+
}
|
387
|
+
}
|
388
|
+
}
|
389
|
+
};
|
390
|
+
|
391
|
+
/**
|
392
|
+
* Sets the style of the InfoBox by setting the style sheet and applying
|
393
|
+
* other specific styles requested.
|
394
|
+
* @private
|
395
|
+
*/
|
396
|
+
InfoBox.prototype.setBoxStyle_ = function () {
|
397
|
+
|
398
|
+
var i, boxStyle;
|
399
|
+
|
400
|
+
if (this.div_) {
|
401
|
+
|
402
|
+
// Apply style values from the style sheet defined in the boxClass parameter:
|
403
|
+
this.div_.className = this.boxClass_;
|
404
|
+
|
405
|
+
// Clear existing inline style values:
|
406
|
+
this.div_.style.cssText = "";
|
407
|
+
|
408
|
+
// Apply style values defined in the boxStyle parameter:
|
409
|
+
boxStyle = this.boxStyle_;
|
410
|
+
for (i in boxStyle) {
|
411
|
+
|
412
|
+
if (boxStyle.hasOwnProperty(i)) {
|
413
|
+
|
414
|
+
this.div_.style[i] = boxStyle[i];
|
415
|
+
}
|
416
|
+
}
|
417
|
+
|
418
|
+
// Fix for iOS disappearing InfoBox problem.
|
419
|
+
// See http://stackoverflow.com/questions/9229535/google-maps-markers-disappear-at-certain-zoom-level-only-on-iphone-ipad
|
420
|
+
this.div_.style.WebkitTransform = "translateZ(0)";
|
421
|
+
|
422
|
+
// Fix up opacity style for benefit of MSIE:
|
423
|
+
//
|
424
|
+
if (typeof this.div_.style.opacity !== "undefined" && this.div_.style.opacity !== "") {
|
425
|
+
// See http://www.quirksmode.org/css/opacity.html
|
426
|
+
this.div_.style.MsFilter = "\"progid:DXImageTransform.Microsoft.Alpha(Opacity=" + (this.div_.style.opacity * 100) + ")\"";
|
427
|
+
this.div_.style.filter = "alpha(opacity=" + (this.div_.style.opacity * 100) + ")";
|
428
|
+
}
|
429
|
+
|
430
|
+
// Apply required styles:
|
431
|
+
//
|
432
|
+
this.div_.style.position = "absolute";
|
433
|
+
this.div_.style.visibility = 'hidden';
|
434
|
+
if (this.zIndex_ !== null) {
|
435
|
+
|
436
|
+
this.div_.style.zIndex = this.zIndex_;
|
437
|
+
}
|
438
|
+
}
|
439
|
+
};
|
440
|
+
|
441
|
+
/**
|
442
|
+
* Get the widths of the borders of the InfoBox.
|
443
|
+
* @private
|
444
|
+
* @return {Object} widths object (top, bottom left, right)
|
445
|
+
*/
|
446
|
+
InfoBox.prototype.getBoxWidths_ = function () {
|
447
|
+
|
448
|
+
var computedStyle;
|
449
|
+
var bw = {top: 0, bottom: 0, left: 0, right: 0};
|
450
|
+
var box = this.div_;
|
451
|
+
|
452
|
+
if (document.defaultView && document.defaultView.getComputedStyle) {
|
453
|
+
|
454
|
+
computedStyle = box.ownerDocument.defaultView.getComputedStyle(box, "");
|
455
|
+
|
456
|
+
if (computedStyle) {
|
457
|
+
|
458
|
+
// The computed styles are always in pixel units (good!)
|
459
|
+
bw.top = parseInt(computedStyle.borderTopWidth, 10) || 0;
|
460
|
+
bw.bottom = parseInt(computedStyle.borderBottomWidth, 10) || 0;
|
461
|
+
bw.left = parseInt(computedStyle.borderLeftWidth, 10) || 0;
|
462
|
+
bw.right = parseInt(computedStyle.borderRightWidth, 10) || 0;
|
463
|
+
}
|
464
|
+
|
465
|
+
} else if (document.documentElement.currentStyle) { // MSIE
|
466
|
+
|
467
|
+
if (box.currentStyle) {
|
468
|
+
|
469
|
+
// The current styles may not be in pixel units, but assume they are (bad!)
|
470
|
+
bw.top = parseInt(box.currentStyle.borderTopWidth, 10) || 0;
|
471
|
+
bw.bottom = parseInt(box.currentStyle.borderBottomWidth, 10) || 0;
|
472
|
+
bw.left = parseInt(box.currentStyle.borderLeftWidth, 10) || 0;
|
473
|
+
bw.right = parseInt(box.currentStyle.borderRightWidth, 10) || 0;
|
474
|
+
}
|
475
|
+
}
|
476
|
+
|
477
|
+
return bw;
|
478
|
+
};
|
479
|
+
|
480
|
+
/**
|
481
|
+
* Invoked when <tt>close</tt> is called. Do not call it directly.
|
482
|
+
*/
|
483
|
+
InfoBox.prototype.onRemove = function () {
|
484
|
+
|
485
|
+
if (this.div_) {
|
486
|
+
|
487
|
+
this.div_.parentNode.removeChild(this.div_);
|
488
|
+
this.div_ = null;
|
489
|
+
}
|
490
|
+
};
|
491
|
+
|
492
|
+
/**
|
493
|
+
* Draws the InfoBox based on the current map projection and zoom level.
|
494
|
+
*/
|
495
|
+
InfoBox.prototype.draw = function () {
|
496
|
+
|
497
|
+
this.createInfoBoxDiv_();
|
498
|
+
|
499
|
+
var pixPosition = this.getProjection().fromLatLngToDivPixel(this.position_);
|
500
|
+
|
501
|
+
this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + "px";
|
502
|
+
|
503
|
+
if (this.alignBottom_) {
|
504
|
+
this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + "px";
|
505
|
+
} else {
|
506
|
+
this.div_.style.top = (pixPosition.y + this.pixelOffset_.height) + "px";
|
507
|
+
}
|
508
|
+
|
509
|
+
if (this.isHidden_) {
|
510
|
+
|
511
|
+
this.div_.style.visibility = "hidden";
|
512
|
+
|
513
|
+
} else {
|
514
|
+
|
515
|
+
this.div_.style.visibility = "visible";
|
516
|
+
}
|
517
|
+
};
|
518
|
+
|
519
|
+
/**
|
520
|
+
* Sets the options for the InfoBox. Note that changes to the <tt>maxWidth</tt>,
|
521
|
+
* <tt>closeBoxMargin</tt>, <tt>closeBoxURL</tt>, and <tt>enableEventPropagation</tt>
|
522
|
+
* properties have no affect until the current InfoBox is <tt>close</tt>d and a new one
|
523
|
+
* is <tt>open</tt>ed.
|
524
|
+
* @param {InfoBoxOptions} opt_opts
|
525
|
+
*/
|
526
|
+
InfoBox.prototype.setOptions = function (opt_opts) {
|
527
|
+
if (typeof opt_opts.boxClass !== "undefined") { // Must be first
|
528
|
+
|
529
|
+
this.boxClass_ = opt_opts.boxClass;
|
530
|
+
this.setBoxStyle_();
|
531
|
+
}
|
532
|
+
if (typeof opt_opts.boxStyle !== "undefined") { // Must be second
|
533
|
+
|
534
|
+
this.boxStyle_ = opt_opts.boxStyle;
|
535
|
+
this.setBoxStyle_();
|
536
|
+
}
|
537
|
+
if (typeof opt_opts.content !== "undefined") {
|
538
|
+
|
539
|
+
this.setContent(opt_opts.content);
|
540
|
+
}
|
541
|
+
if (typeof opt_opts.disableAutoPan !== "undefined") {
|
542
|
+
|
543
|
+
this.disableAutoPan_ = opt_opts.disableAutoPan;
|
544
|
+
}
|
545
|
+
if (typeof opt_opts.maxWidth !== "undefined") {
|
546
|
+
|
547
|
+
this.maxWidth_ = opt_opts.maxWidth;
|
548
|
+
}
|
549
|
+
if (typeof opt_opts.pixelOffset !== "undefined") {
|
550
|
+
|
551
|
+
this.pixelOffset_ = opt_opts.pixelOffset;
|
552
|
+
}
|
553
|
+
if (typeof opt_opts.alignBottom !== "undefined") {
|
554
|
+
|
555
|
+
this.alignBottom_ = opt_opts.alignBottom;
|
556
|
+
}
|
557
|
+
if (typeof opt_opts.position !== "undefined") {
|
558
|
+
|
559
|
+
this.setPosition(opt_opts.position);
|
560
|
+
}
|
561
|
+
if (typeof opt_opts.zIndex !== "undefined") {
|
562
|
+
|
563
|
+
this.setZIndex(opt_opts.zIndex);
|
564
|
+
}
|
565
|
+
if (typeof opt_opts.closeBoxMargin !== "undefined") {
|
566
|
+
|
567
|
+
this.closeBoxMargin_ = opt_opts.closeBoxMargin;
|
568
|
+
}
|
569
|
+
if (typeof opt_opts.closeBoxURL !== "undefined") {
|
570
|
+
|
571
|
+
this.closeBoxURL_ = opt_opts.closeBoxURL;
|
572
|
+
}
|
573
|
+
if (typeof opt_opts.infoBoxClearance !== "undefined") {
|
574
|
+
|
575
|
+
this.infoBoxClearance_ = opt_opts.infoBoxClearance;
|
576
|
+
}
|
577
|
+
if (typeof opt_opts.isHidden !== "undefined") {
|
578
|
+
|
579
|
+
this.isHidden_ = opt_opts.isHidden;
|
580
|
+
}
|
581
|
+
if (typeof opt_opts.visible !== "undefined") {
|
582
|
+
|
583
|
+
this.isHidden_ = !opt_opts.visible;
|
584
|
+
}
|
585
|
+
if (typeof opt_opts.enableEventPropagation !== "undefined") {
|
586
|
+
|
587
|
+
this.enableEventPropagation_ = opt_opts.enableEventPropagation;
|
588
|
+
}
|
589
|
+
|
590
|
+
if (this.div_) {
|
591
|
+
|
592
|
+
this.draw();
|
593
|
+
}
|
594
|
+
};
|
595
|
+
|
596
|
+
/**
|
597
|
+
* Sets the content of the InfoBox.
|
598
|
+
* The content can be plain text or an HTML DOM node.
|
599
|
+
* @param {string|Node} content
|
600
|
+
*/
|
601
|
+
InfoBox.prototype.setContent = function (content) {
|
602
|
+
this.content_ = content;
|
603
|
+
|
604
|
+
if (this.div_) {
|
605
|
+
|
606
|
+
if (this.closeListener_) {
|
607
|
+
|
608
|
+
google.maps.event.removeListener(this.closeListener_);
|
609
|
+
this.closeListener_ = null;
|
610
|
+
}
|
611
|
+
|
612
|
+
// Odd code required to make things work with MSIE.
|
613
|
+
//
|
614
|
+
if (!this.fixedWidthSet_) {
|
615
|
+
|
616
|
+
this.div_.style.width = "";
|
617
|
+
}
|
618
|
+
|
619
|
+
if (typeof content.nodeType === "undefined") {
|
620
|
+
this.div_.innerHTML = this.getCloseBoxImg_() + content;
|
621
|
+
} else {
|
622
|
+
this.div_.innerHTML = this.getCloseBoxImg_();
|
623
|
+
this.div_.appendChild(content);
|
624
|
+
}
|
625
|
+
|
626
|
+
// Perverse code required to make things work with MSIE.
|
627
|
+
// (Ensures the close box does, in fact, float to the right.)
|
628
|
+
//
|
629
|
+
if (!this.fixedWidthSet_) {
|
630
|
+
this.div_.style.width = this.div_.offsetWidth + "px";
|
631
|
+
if (typeof content.nodeType === "undefined") {
|
632
|
+
this.div_.innerHTML = this.getCloseBoxImg_() + content;
|
633
|
+
} else {
|
634
|
+
this.div_.innerHTML = this.getCloseBoxImg_();
|
635
|
+
this.div_.appendChild(content);
|
636
|
+
}
|
637
|
+
}
|
638
|
+
|
639
|
+
this.addClickHandler_();
|
640
|
+
}
|
641
|
+
|
642
|
+
/**
|
643
|
+
* This event is fired when the content of the InfoBox changes.
|
644
|
+
* @name InfoBox#content_changed
|
645
|
+
* @event
|
646
|
+
*/
|
647
|
+
google.maps.event.trigger(this, "content_changed");
|
648
|
+
};
|
649
|
+
|
650
|
+
/**
|
651
|
+
* Sets the geographic location of the InfoBox.
|
652
|
+
* @param {LatLng} latlng
|
653
|
+
*/
|
654
|
+
InfoBox.prototype.setPosition = function (latlng) {
|
655
|
+
|
656
|
+
this.position_ = latlng;
|
657
|
+
|
658
|
+
if (this.div_) {
|
659
|
+
|
660
|
+
this.draw();
|
661
|
+
}
|
662
|
+
|
663
|
+
/**
|
664
|
+
* This event is fired when the position of the InfoBox changes.
|
665
|
+
* @name InfoBox#position_changed
|
666
|
+
* @event
|
667
|
+
*/
|
668
|
+
google.maps.event.trigger(this, "position_changed");
|
669
|
+
};
|
670
|
+
|
671
|
+
/**
|
672
|
+
* Sets the zIndex style for the InfoBox.
|
673
|
+
* @param {number} index
|
674
|
+
*/
|
675
|
+
InfoBox.prototype.setZIndex = function (index) {
|
676
|
+
|
677
|
+
this.zIndex_ = index;
|
678
|
+
|
679
|
+
if (this.div_) {
|
680
|
+
|
681
|
+
this.div_.style.zIndex = index;
|
682
|
+
}
|
683
|
+
|
684
|
+
/**
|
685
|
+
* This event is fired when the zIndex of the InfoBox changes.
|
686
|
+
* @name InfoBox#zindex_changed
|
687
|
+
* @event
|
688
|
+
*/
|
689
|
+
google.maps.event.trigger(this, "zindex_changed");
|
690
|
+
};
|
691
|
+
|
692
|
+
/**
|
693
|
+
* Sets the visibility of the InfoBox.
|
694
|
+
* @param {boolean} isVisible
|
695
|
+
*/
|
696
|
+
InfoBox.prototype.setVisible = function (isVisible) {
|
697
|
+
|
698
|
+
this.isHidden_ = !isVisible;
|
699
|
+
if (this.div_) {
|
700
|
+
this.div_.style.visibility = (this.isHidden_ ? "hidden" : "visible");
|
701
|
+
}
|
702
|
+
};
|
703
|
+
|
704
|
+
/**
|
705
|
+
* Returns the content of the InfoBox.
|
706
|
+
* @returns {string}
|
707
|
+
*/
|
708
|
+
InfoBox.prototype.getContent = function () {
|
709
|
+
|
710
|
+
return this.content_;
|
711
|
+
};
|
712
|
+
|
713
|
+
/**
|
714
|
+
* Returns the geographic location of the InfoBox.
|
715
|
+
* @returns {LatLng}
|
716
|
+
*/
|
717
|
+
InfoBox.prototype.getPosition = function () {
|
718
|
+
|
719
|
+
return this.position_;
|
720
|
+
};
|
721
|
+
|
722
|
+
/**
|
723
|
+
* Returns the zIndex for the InfoBox.
|
724
|
+
* @returns {number}
|
725
|
+
*/
|
726
|
+
InfoBox.prototype.getZIndex = function () {
|
727
|
+
|
728
|
+
return this.zIndex_;
|
729
|
+
};
|
730
|
+
|
731
|
+
/**
|
732
|
+
* Returns a flag indicating whether the InfoBox is visible.
|
733
|
+
* @returns {boolean}
|
734
|
+
*/
|
735
|
+
InfoBox.prototype.getVisible = function () {
|
736
|
+
|
737
|
+
var isVisible;
|
738
|
+
|
739
|
+
if ((typeof this.getMap() === "undefined") || (this.getMap() === null)) {
|
740
|
+
isVisible = false;
|
741
|
+
} else {
|
742
|
+
isVisible = !this.isHidden_;
|
743
|
+
}
|
744
|
+
return isVisible;
|
745
|
+
};
|
746
|
+
|
747
|
+
/**
|
748
|
+
* Shows the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
|
749
|
+
*/
|
750
|
+
InfoBox.prototype.show = function () {
|
751
|
+
|
752
|
+
this.isHidden_ = false;
|
753
|
+
if (this.div_) {
|
754
|
+
this.div_.style.visibility = "visible";
|
755
|
+
}
|
756
|
+
};
|
757
|
+
|
758
|
+
/**
|
759
|
+
* Hides the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
|
760
|
+
*/
|
761
|
+
InfoBox.prototype.hide = function () {
|
762
|
+
|
763
|
+
this.isHidden_ = true;
|
764
|
+
if (this.div_) {
|
765
|
+
this.div_.style.visibility = "hidden";
|
766
|
+
}
|
767
|
+
};
|
768
|
+
|
769
|
+
/**
|
770
|
+
* Adds the InfoBox to the specified map or Street View panorama. If <tt>anchor</tt>
|
771
|
+
* (usually a <tt>google.maps.Marker</tt>) is specified, the position
|
772
|
+
* of the InfoBox is set to the position of the <tt>anchor</tt>. If the
|
773
|
+
* anchor is dragged to a new location, the InfoBox moves as well.
|
774
|
+
* @param {Map|StreetViewPanorama} map
|
775
|
+
* @param {MVCObject} [anchor]
|
776
|
+
*/
|
777
|
+
InfoBox.prototype.open = function (map, anchor) {
|
778
|
+
|
779
|
+
var me = this;
|
780
|
+
|
781
|
+
if (anchor) {
|
782
|
+
|
783
|
+
this.position_ = anchor.getPosition();
|
784
|
+
this.moveListener_ = google.maps.event.addListener(anchor, "position_changed", function () {
|
785
|
+
me.setPosition(this.getPosition());
|
786
|
+
});
|
787
|
+
}
|
788
|
+
|
789
|
+
this.setMap(map);
|
790
|
+
|
791
|
+
if (this.div_) {
|
792
|
+
|
793
|
+
this.panBox_();
|
794
|
+
}
|
795
|
+
};
|
796
|
+
|
797
|
+
/**
|
798
|
+
* Removes the InfoBox from the map.
|
799
|
+
*/
|
800
|
+
InfoBox.prototype.close = function () {
|
801
|
+
|
802
|
+
var i;
|
803
|
+
|
804
|
+
if (this.closeListener_) {
|
805
|
+
|
806
|
+
google.maps.event.removeListener(this.closeListener_);
|
807
|
+
this.closeListener_ = null;
|
808
|
+
}
|
809
|
+
|
810
|
+
if (this.eventListeners_) {
|
811
|
+
|
812
|
+
for (i = 0; i < this.eventListeners_.length; i++) {
|
813
|
+
|
814
|
+
google.maps.event.removeListener(this.eventListeners_[i]);
|
815
|
+
}
|
816
|
+
this.eventListeners_ = null;
|
817
|
+
}
|
818
|
+
|
819
|
+
if (this.moveListener_) {
|
820
|
+
|
821
|
+
google.maps.event.removeListener(this.moveListener_);
|
822
|
+
this.moveListener_ = null;
|
823
|
+
}
|
824
|
+
|
825
|
+
if (this.contextListener_) {
|
826
|
+
|
827
|
+
google.maps.event.removeListener(this.contextListener_);
|
828
|
+
this.contextListener_ = null;
|
829
|
+
}
|
830
|
+
|
831
|
+
this.setMap(null);
|
832
|
+
};
|
833
|
+
|
834
|
+
/**
|
835
|
+
* END OF ORIGINAL infobox.js ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
|
836
|
+
*/
|
837
|
+
window.InfoBox = InfoBox;
|
838
|
+
}
|
839
|
+
}
|
840
|
+
//
|
841
|
+
// Public methods / properties
|
842
|
+
//
|
843
|
+
window.infoBoxLoader = init;
|
844
|
+
}(window));
|
data/src/js/gmapz/gmapz.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
====================================
|
3
3
|
GMapz. Yet another gmaps manager
|
4
|
-
by carlos Cabo 2015. V.2.
|
4
|
+
by carlos Cabo 2015. V.2.10
|
5
5
|
https://github.com/carloscabo/gmapz
|
6
6
|
====================================
|
7
7
|
*/
|
@@ -21,7 +21,7 @@
|
|
21
21
|
// Module general vars
|
22
22
|
//
|
23
23
|
var
|
24
|
-
v = '2.
|
24
|
+
v = '2.10',
|
25
25
|
debug = false,
|
26
26
|
data = {
|
27
27
|
map_api_requested: false,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmapz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- carloscabo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- src/img/gmapz/pin.png
|
69
69
|
- src/img/gmapz/scroll_disabled.svg
|
70
70
|
- src/img/gmapz/scroll_enabled.svg
|
71
|
+
- src/js/gmapz-dependencies/infobox.modified.js
|
71
72
|
- src/js/gmapz-dependencies/markerclusterer.js
|
72
73
|
- src/js/gmapz/gmapz.autocomplete.js
|
73
74
|
- src/js/gmapz/gmapz.js
|
@@ -95,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
96
|
version: '0'
|
96
97
|
requirements: []
|
97
98
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.5.2
|
99
100
|
signing_key:
|
100
101
|
specification_version: 4
|
101
102
|
summary: GMapz is yet another Google Maps JS library.
|