PageSourceSearch

https://www.bretton.cz/web/bundles/seller/js/markerwithlabel.js

js bretton.cz collected 2026-09-30 21:03:26 UTC 24,939 bytes, 582 lines download raw bytes

1/**
2 * @name MarkerWithLabel for V3
3 * @version 1.1.10 [April 8, 2014]
4 * @author Gary Little (inspired by code from Marc Ridey of Google).
5 * @copyright Copyright 2012 Gary Little [gary at luxcentral.com]
6 * @fileoverview MarkerWithLabel extends the Google Maps JavaScript API V3
7 *  <code>google.maps.Marker</code> class.
8 *  <p>
9 *  MarkerWithLabel allows you to define markers with associated labels. As you would expect,
10 *  if the marker is draggable, so too will be the label. In addition, a marker with a label
11 *  responds to all mouse events in the same manner as a regular marker. It also fires mouse
12 *  events and "property changed" events just as a regular marker would. Version 1.1 adds
13 *  support for the raiseOnDrag feature introduced in API V3.3.
14 *  <p>
15 *  If you drag a marker by its label, you can cancel the drag and return the marker to its
16 *  original position by pressing the <code>Esc</code> key. This doesn't work if you drag the marker
17 *  itself because this feature is not (yet) supported in the <code>google.maps.Marker</code> class.
18 */
19
20/*!
21 *
22 * Licensed under the Apache License, Version 2.0 (the "License");
23 * you may not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
25 *
26 *       http://www.apache.org/licenses/LICENSE-2.0
27 *
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
33 */
34
35/*jslint browser:true */
36/*global document,google */
37
38/**
39 * @param {Function} childCtor Child class.
40 * @param {Function} parentCtor Parent class.
41 * @private
42 */
43function inherits(childCtor, parentCtor) {
44  /* @constructor */
45  function tempCtor() {}
46  tempCtor.prototype = parentCtor.prototype;
47  childCtor.superClass_ = parentCtor.prototype;
48  childCtor.prototype = new tempCtor();
49  /* @override */
50  childCtor.prototype.constructor = childCtor;
51}
52
53/**
54 * This constructor creates a label and associates it with a marker.
55 * It is for the private use of the MarkerWithLabel class.
56 * @constructor
57 * @param {Marker} marker The marker with which the label is to be associated.
58 * @param {string} crossURL The URL of the cross image =.
59 * @param {string} handCursor The URL of the hand cursor.
60 * @private
61 */
62function MarkerLabel_(marker, crossURL, handCursorURL) {
63  this.marker_ = marker;
64  this.handCursorURL_ = marker.handCursorURL;
65
66  this.labelDiv_ = document.createElement("div");
67  this.labelDiv_.style.cssText = "position: absolute; overflow: hidden;";
68
69  // Set up the DIV for handling mouse events in the label. This DIV forms a transparent veil
70  // in the "overlayMouseTarget" pane, a veil that covers just the label. This is done so that
71  // events can be captured even if the label is in the shadow of a google.maps.InfoWindow.
72  // Code is included here to ensure the veil is always exactly the same size as the label.
73  this.eventDiv_ = document.createElement("div");
74  this.eventDiv_.style.cssText = this.labelDiv_.style.cssText;
75
76  // This is needed for proper behavior on MSIE:
77  this.eventDiv_.setAttribute("onselectstart", "return false;");
78  this.eventDiv_.setAttribute("ondragstart", "return false;");
79
80  // Get the DIV for the "X" to be displayed when the marker is raised.
81  this.crossDiv_ = MarkerLabel_.getSharedCross(crossURL);
82}
83
84inherits(MarkerLabel_, google.maps.OverlayView);
85
86/**
87 * Returns the DIV for the cross used when dragging a marker when the
88 * raiseOnDrag parameter set to true. One cross is shared with all markers.
89 * @param {string} crossURL The URL of the cross image =.
90 * @private
91 */
92MarkerLabel_.getSharedCross = function (crossURL) {
93  var div;
94  if (typeof MarkerLabel_.getSharedCross.crossDiv === "undefined") {
95    div = document.createElement("img");
96    div.style.cssText = "position: absolute; z-index: 1000002; display: none;";
97    // Hopefully Google never changes the standard "X" attributes:
98    div.style.marginLeft = "-8px";
99    div.style.marginTop = "-9px";
100    div.src = crossURL;
101    MarkerLabel_.getSharedCross.crossDiv = div;
102  }
103  return MarkerLabel_.getSharedCross.crossDiv;
104};
105
106/**
107 * Adds the DIV representing the label to the DOM. This method is called
108 * automatically when the marker's <code>setMap</code> method is called.
109 * @private
110 */
111MarkerLabel_.prototype.onAdd = function () {
112  var me = this;
113  var cMouseIsDown = false;
114  var cDraggingLabel = false;
115  var cSavedZIndex;
116  var cLatOffset, cLngOffset;
117  var cIgnoreClick;
118  var cRaiseEnabled;
119  var cStartPosition;
120  var cStartCenter;
121  // Constants:
122  var cRaiseOffset = 20;
123  var cDraggingCursor = "url(" + this.handCursorURL_ + ")";
124
125  // Stops all processing of an event.
126  //
127  var cAbortEvent = function (e) {
128    if (e.preventDefault) {
129      e.preventDefault();
130    }
131    e.cancelBubble = true;
132    if (e.stopPropagation) {
133      e.stopPropagation();
134    }
135  };
136
137  var cStopBounce = function () {
138    me.marker_.setAnimation(null);
139  };
140
141  this.getPanes().markerLayer.appendChild(this.labelDiv_);
142  this.getPanes().overlayMouseTarget.appendChild(this.eventDiv_);
143  // One cross is shared with all markers, so only add it once:
144  if (typeof MarkerLabel_.getSharedCross.processed === "undefined") {
145    this.getPanes().markerLayer
vendor: 19,522 bytes, lines 145-582
145.appendChild(this.crossDiv_);
146    MarkerLabel_.getSharedCross.processed = true;
147  }
148
149  this.listeners_ = [
150    google.maps.event.addDomListener(this.eventDiv_, "mouseover", function (e) {
151      if (me.marker_.getDraggable() || me.marker_.getClickable()) {
152        this.style.cursor = "pointer";
153        google.maps.event.trigger(me.marker_, "mouseover", e);
154      }
155    }),
156    google.maps.event.addDomListener(this.eventDiv_, "mouseout", function (e) {
157      if ((me.marker_.getDraggable() || me.marker_.getClickable()) && !cDraggingLabel) {
158        this.style.cursor = me.marker_.getCursor();
159        google.maps.event.trigger(me.marker_, "mouseout", e);
160      }
161    }),
162    google.maps.event.addDomListener(this.eventDiv_, "mousedown", function (e) {
163      cDraggingLabel = false;
164      if (me.marker_.getDraggable()) {
165        cMouseIsDown = true;
166        this.style.cursor = cDraggingCursor;
167      }
168      if (me.marker_.getDraggable() || me.marker_.getClickable()) {
169        google.maps.event.trigger(me.marker_, "mousedown", e);
170        cAbortEvent(e); // Prevent map pan when starting a drag on a label
171      }
172    }),
173    google.maps.event.addDomListener(document, "mouseup", function (mEvent) {
174      var position;
175      if (cMouseIsDown) {
176        cMouseIsDown = false;
177        me.eventDiv_.style.cursor = "pointer";
178        google.maps.event.trigger(me.marker_, "mouseup", mEvent);
179      }
180      if (cDraggingLabel) {
181        if (cRaiseEnabled) { // Lower the marker & label
182          position = me.getProjection().fromLatLngToDivPixel(me.marker_.getPosition());
183          position.y += cRaiseOffset;
184          me.marker_.setPosition(me.getProjection().fromDivPixelToLatLng(position));
185          // This is not the same bouncing style as when the marker portion is dragged,
186          // but it will have to do:
187          try { // Will fail if running Google Maps API earlier than V3.3
188            me.marker_.setAnimation(google.maps.Animation.BOUNCE);
189            setTimeout(cStopBounce, 1406);
190          } catch (e) {}
191        }
192        me.crossDiv_.style.display = "none";
193        me.marker_.setZIndex(cSavedZIndex);
194        cIgnoreClick = true; // Set flag to ignore the click event reported after a label drag
195        cDraggingLabel = false;
196        mEvent.latLng = me.marker_.getPosition();
197        google.maps.event.trigger(me.marker_, "dragend", mEvent);
198      }
199    }),
200    google.maps.event.addListener(me.marker_.getMap(), "mousemove", function (mEvent) {
201      var position;
202      if (cMouseIsDown) {
203        if (cDraggingLabel) {
204          // Change the reported location from the mouse position to the marker position:
205          mEvent.latLng = new google.maps.LatLng(mEvent.latLng.lat() - cLatOffset, mEvent.latLng.lng() - cLngOffset);
206          position = me.getProjection().fromLatLngToDivPixel(mEvent.latLng);
207          if (cRaiseEnabled) {
208            me.crossDiv_.style.left = position.x + "px";
209            me.crossDiv_.style.top = position.y + "px";
210            me.crossDiv_.style.display = "";
211            position.y -= cRaiseOffset;
212          }
213          me.marker_.setPosition(me.getProjection().fromDivPixelToLatLng(position));
214          if (cRaiseEnabled) { // Don't raise the veil; this hack needed to make MSIE act properly
215            me.eventDiv_.style.top = (position.y + cRaiseOffset) + "px";
216          }
217          google.maps.event.trigger(me.marker_, "drag", mEvent);
218        } else {
219          // Calculate offsets from the click point to the marker position:
220          cLatOffset = mEvent.latLng.lat() - me.marker_.getPosition().lat();
221          cLngOffset = mEvent.latLng.lng() - me.marker_.getPosition().lng();
222          cSavedZIndex = me.marker_.getZIndex();
223          cStartPosition = me.marker_.getPosition();
224          cStartCenter = me.marker_.getMap().getCenter();
225          cRaiseEnabled = me.marker_.get("raiseOnDrag");
226          cDraggingLabel = true;
227          me.marker_.setZIndex(1000000); // Moves the marker & label to the foreground during a drag
228          mEvent.latLng = me.marker_.getPosition();
229          google.maps.event.trigger(me.marker_, "dragstart", mEvent);
230        }
231      }
232    }),
233    google.maps.event.addDomListener(document, "keydown", function (e) {
234      if (cDraggingLabel) {
235        if (e.keyCode === 27) { // Esc key
236          cRaiseEnabled = false;
237          me.marker_.setPosition(cStartPosition);
238          me.marker_.getMap().setCenter(cStartCenter);
239          google.maps.event.trigger(document, "mouseup", e);
240        }
241      }
242    }),
243    google.maps.event.addDomListener(this.eventDiv_, "click", function (e) {
244      if (me.marker_.getDraggable() || me.marker_.getClickable()) {
245        if (cIgnoreClick) { // Ignore the click reported when a label drag ends
246          cIgnoreClick = false;
247        } else {
248          google.maps.event.trigger(me.marker_, "click", e);
249          cAbortEvent(e); // Prevent click from being passed on to map
250        }
251      }
252    }),
253    google.maps.event.addDomListener(this.eventDiv_, "dblclick", function (e) {
254      if (me.marker_.getDraggable() || me.marker_.getClickable()) {
255        google.maps.event.trigger(me.marker_, "dblclick", e);
256        cAbortEvent(e); // Prevent map zoom when double-clicking on a label
257      }
258    }),
259    google.maps.event.addListener(this.marker_, "dragstart", function (mEvent) {
260      if (!cDraggingLabel) {
261        cRaiseEnabled = this.get("raiseOnDrag");
262      }
263    }),
264    google.maps.event.addListener(this.marker_, "drag", function (mEvent) {
265      if (!cDraggingLabel) {
266        if (cRaiseEnabled) {
267          me.setPosition(cRaiseOffset);
268          // During a drag, the marker's z-index is temporarily set to 1000000 to
269          // ensure it appears above all other markers. Also set the label's z-index
270          // to 1000000 (plus or minus 1 depending on whether the label is supposed
271          // to be above or below the marker).
272          me.labelDiv_.style.zIndex = 1000000 + (this.get("labelInBackground") ? -1 : +1);
273        }
274      }
275    }),
276    google.maps.event.addListener(this.marker_, "dragend", function (mEvent) {
277      if (!cDraggingLabel) {
278        if (cRaiseEnabled) {
279          me.setPosition(0); // Also restores z-index of label
280        }
281      }
282    }),
283    google.maps.event.addListener(this.marker_, "position_changed", function () {
284      me.setPosition();
285    }),
286    google.maps.event.addListener(this.marker_, "zindex_changed", function () {
287      me.setZIndex();
288    }),
289    google.maps.event.addListener(this.marker_, "visible_changed", function () {
290      me.setVisible();
291    }),
292    google.maps.event.addListener(this.marker_, "labelvisible_changed", function () {
293      me.setVisible();
294    }),
295    google.maps.event.addListener(this.marker_, "title_changed", function () {
296      me.setTitle();
297    }),
298    google.maps.event.addListener(this.marker_, "labelcontent_changed", function () {
299      me.setContent();
300    }),
301    google.maps.event.addListener(this.marker_, "labelanchor_changed", function () {
302      me.setAnchor();
303    }),
304    google.maps.event.addListener(this.marker_, "labelclass_changed", function () {
305      me.setStyles();
306    }),
307    google.maps.event.addListener(this.marker_, "labelstyle_changed", function () {
308      me.setStyles();
309    })
310  ];
311};
312
313/**
314 * Removes the DIV for the label from the DOM. It also removes all event handlers.
315 * This method is called automatically when the marker's <code>setMap(null)</code>
316 * method is called.
317 * @private
318 */
319MarkerLabel_.prototype.onRemove = function () {
320  var i;
321  this.labelDiv_.parentNode.removeChild(this.labelDiv_);
322  this.eventDiv_.parentNode.removeChild(this.eventDiv_);
323
324  // Remove event listeners:
325  for (i = 0; i < this.listeners_.length; i++) {
326    google.maps.event.removeListener(this.listeners_[i]);
327  }
328};
329
330/**
331 * Draws the label on the map.
332 * @private
333 */
334MarkerLabel_.prototype.draw = function () {
335  this.setContent();
336  this.setTitle();
337  this.setStyles();
338};
339
340/**
341 * Sets the content of the label.
342 * The content can be plain text or an HTML DOM node.
343 * @private
344 */
345MarkerLabel_.prototype.setContent = function () {
346  var content = this.marker_.get("labelContent");
347  if (typeof content.nodeType === "undefined") {
348    this.labelDiv_.innerHTML = content;
349    this.eventDiv_.innerHTML = this.labelDiv_.innerHTML;
350  } else {
351    this.labelDiv_.innerHTML = ""; // Remove current content
352    this.labelDiv_.appendChild(content);
353    content = content.cloneNode(true);
354    this.eventDiv_.innerHTML = ""; // Remove current content
355    this.eventDiv_.appendChild(content);
356  }
357};
358
359/**
360 * Sets the content of the tool tip for the label. It is
361 * always set to be the same as for the marker itself.
362 * @private
363 */
364MarkerLabel_.prototype.setTitle = function () {
365  this.eventDiv_.title = this.marker_.getTitle() || "";
366};
367
368/**
369 * Sets the style of the label by setting the style sheet and applying
370 * other specific styles requested.
371 * @private
372 */
373MarkerLabel_.prototype.setStyles = function () {
374  var i, labelStyle;
375
376  // Apply style values from the style sheet defined in the labelClass parameter:
377  this.labelDiv_.className = this.marker_.get("labelClass");
378  this.eventDiv_.className = this.labelDiv_.className;
379
380  // Clear existing inline style values:
381  this.labelDiv_.style.cssText = "";
382  this.eventDiv_.style.cssText = "";
383  // Apply style values defined in the labelStyle parameter:
384  labelStyle = this.marker_.get("labelStyle");
385  for (i in labelStyle) {
386    if (labelStyle.hasOwnProperty(i)) {
387      this.labelDiv_.style[i] = labelStyle[i];
388      this.eventDiv_.style[i] = labelStyle[i];
389    }
390  }
391  this.setMandatoryStyles();
392};
393
394/**
395 * Sets the mandatory styles to the DIV representing the label as well as to the
396 * associated event DIV. This includes setting the DIV position, z-index, and visibility.
397 * @private
398 */
399MarkerLabel_.prototype.setMandatoryStyles = function () {
400  this.labelDiv_.style.position = "absolute";
401  this.labelDiv_.style.overflow = "hidden";
402  // Make sure the opacity setting causes the desired effect on MSIE:
403  if (typeof this.labelDiv_.style.opacity !== "undefined" && this.labelDiv_.style.opacity !== "") {
404    this.labelDiv_.style.MsFilter = "\"progid:DXImageTransform.Microsoft.Alpha(opacity=" + (this.labelDiv_.style.opacity * 100) + ")\"";
405    this.labelDiv_.style.filter = "alpha(opacity=" + (this.labelDiv_.style.opacity * 100) + ")";
406  }
407
408  this.eventDiv_.style.position = this.labelDiv_.style.position;
409  this.eventDiv_.style.overflow = this.labelDiv_.style.overflow;
410  this.eventDiv_.style.opacity = 0.01; // Don't use 0; DIV won't be clickable on MSIE
411  this.eventDiv_.style.MsFilter = "\"progid:DXImageTransform.Microsoft.Alpha(opacity=1)\"";
412  this.eventDiv_.style.filter = "alpha(opacity=1)"; // For MSIE
413
414  this.setAnchor();
415  this.setPosition(); // This also updates z-index, if necessary.
416  this.setVisible();
417};
418
419/**
420 * Sets the anchor point of the label.
421 * @private
422 */
423MarkerLabel_.prototype.setAnchor = function () {
424  var anchor = this.marker_.get("labelAnchor");
425  this.labelDiv_.style.marginLeft = -anchor.x + "px";
426  this.labelDiv_.style.marginTop = -anchor.y + "px";
427  this.eventDiv_.style.marginLeft = -anchor.x + "px";
428  this.eventDiv_.style.marginTop = -anchor.y + "px";
429};
430
431/**
432 * Sets the position of the label. The z-index is also updated, if necessary.
433 * @private
434 */
435MarkerLabel_.prototype.setPosition = function (yOffset) {
436  var position = this.getProjection().fromLatLngToDivPixel(this.marker_.getPosition());
437  if (typeof yOffset === "undefined") {
438    yOffset = 0;
439  }
440  this.labelDiv_.style.left = Math.round(position.x) + "px";
441  this.labelDiv_.style.top = Math.round(position.y - yOffset) + "px";
442  this.eventDiv_.style.left = this.labelDiv_.style.left;
443  this.eventDiv_.style.top = this.labelDiv_.style.top;
444
445  this.setZIndex();
446};
447
448/**
449 * Sets the z-index of the label. If the marker's z-index property has not been defined, the z-index
450 * of the label is set to the vertical coordinate of the label. This is in keeping with the default
451 * stacking order for Google Maps: markers to the south are in front of markers to the north.
452 * @private
453 */
454MarkerLabel_.prototype.setZIndex = function () {
455  var zAdjust = (this.marker_.get("labelInBackground") ? -1 : +1);
456  if (typeof this.marker_.getZIndex() === "undefined") {
457    this.labelDiv_.style.zIndex = parseInt(this.labelDiv_.style.top, 10) + zAdjust;
458    this.eventDiv_.style.zIndex = this.labelDiv_.style.zIndex;
459  } else {
460    this.labelDiv_.style.zIndex = this.marker_.getZIndex() + zAdjust;
461    this.eventDiv_.style.zIndex = this.labelDiv_.style.zIndex;
462  }
463};
464
465/**
466 * Sets the visibility of the label. The label is visible only if the marker itself is
467 * visible (i.e., its visible property is true) and the labelVisible property is true.
468 * @private
469 */
470MarkerLabel_.prototype.setVisible = function () {
471  if (this.marker_.get("labelVisible")) {
472    this.labelDiv_.style.display = this.marker_.getVisible() ? "block" : "none";
473  } else {
474    this.labelDiv_.style.display = "none";
475  }
476  this.eventDiv_.style.display = this.labelDiv_.style.display;
477};
478
479/**
480 * @name MarkerWithLabelOptions
481 * @class This class represents the optional parameter passed to the {@link MarkerWithLabel} constructor.
482 *  The properties available are the same as for <code>google.maps.Marker</code> with the addition
483 *  of the properties listed below. To change any of these additional properties after the labeled
484 *  marker has been created, call <code>google.maps.Marker.set(propertyName, propertyValue)</code>.
485 *  <p>
486 *  When any of these properties changes, a property changed event is fired. The names of these
487 *  events are derived from the name of the property and are of the form <code>propertyname_changed</code>.
488 *  For example, if the content of the label changes, a <code>labelcontent_changed</code> event
489 *  is fired.
490 *  <p>
491 * @property {string|Node} [labelContent] The content of the label (plain text or an HTML DOM node).
492 * @property {Point} [labelAnchor] By default, a label is drawn with its anchor point at (0,0) so
493 *  that its top left corner is positioned at the anchor point of the associated marker. Use this
494 *  property to change the anchor point of the label. For example, to center a 50px-wide label
495 *  beneath a marker, specify a <code>labelAnchor</code> of <code>google.maps.Point(25, 0)</code>.
496 *  (Note: x-values increase to the right and y-values increase to the top.)
497 * @property {string} [labelClass] The name of the CSS class defining the styles for the label.
498 *  Note that style values for <code>position</code>, <code>overflow</code>, <code>top</code>,
499 *  <code>left</code>, <code>zIndex</code>, <code>display</code>, <code>marginLeft</code>, and
500 *  <code>marginTop</code> are ignored; these styles are for internal use only.
501 * @property {Object} [labelStyle] An object literal whose properties define specific CSS
502 *  style values to be applied to the label. Style values defined here override those that may
503 *  be defined in the <code>labelClass</code> style sheet. If this property is changed after the
504 *  label has been created, all previously set styles (except those defined in the style sheet)
505 *  are removed from the label before the new style values are applied.
506 *  Note that style values for <code>position</code>, <code>overflow</code>, <code>top</code>,
507 *  <code>left</code>, <code>zIndex</code>, <code>display</code>, <code>marginLeft</code>, and
508 *  <code>marginTop</code> are ignored; these styles are for internal use only.
509 * @property {boolean} [labelInBackground] A flag indicating whether a label that overlaps its
510 *  associated marker should appear in the background (i.e., in a plane below the marker).
511 *  The default is <code>false</code>, which causes the label to appear in the foreground.
512 * @property {boolean} [labelVisible] A flag indicating whether the label is to be visible.
513 *  The default is <code>true</code>. Note that even if <code>labelVisible</code> is
514 *  <code>true</code>, the label will <i>not</i> be visible unless the associated marker is also
515 *  visible (i.e., unless the marker's <code>visible</code> property is <code>true</code>).
516 * @property {boolean} [raiseOnDrag] A flag indicating whether the label and marker are to be
517 *  raised when the marker is dragged. The default is <code>true</code>. If a draggable marker is
518 *  being created and a version of Google Maps API earlier than V3.3 is being used, this property
519 *  must be set to <code>false</code>.
520 * @property {boolean} [optimized] A flag indicating whether rendering is to be optimized for the
521 *  marker. <b>Important: The optimized rendering technique is not supported by MarkerWithLabel,
522 *  so the value of this parameter is always forced to <code>false</code>.
523 * @property {string} [crossImage="http://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png"]
524 *  The URL of the cross image to be displayed while dragging a marker.
525 * @property {string} [handCursor="http://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur"]
526 *  The URL of the cursor to be displayed while dragging a marker.
527 */
528/**
529 * Creates a MarkerWithLabel with the options specified in {@link MarkerWithLabelOptions}.
530 * @constructor
531 * @param {MarkerWithLabelOptions} [opt_options] The optional parameters.
532 */
533function MarkerWithLabel(opt_options) {
534  opt_options = opt_options || {};
535  opt_options.labelContent = opt_options.labelContent || "";
536  opt_options.labelAnchor = opt_options.labelAnchor || new google.maps.Point(0, 0);
537  opt_options.labelClass = opt_options.labelClass || "markerLabels";
538  opt_options.labelStyle = opt_options.labelStyle || {};
539  opt_options.labelInBackground = opt_options.labelInBackground || false;
540  if (typeof opt_options.labelVisible === "undefined") {
541    opt_options.labelVisible = true;
542  }
543  if (typeof opt_options.raiseOnDrag === "undefined") {
544    opt_options.raiseOnDrag = true;
545  }
546  if (typeof opt_options.clickable === "undefined") {
547    opt_options.clickable = true;
548  }
549  if (typeof opt_options.draggable === "undefined") {
550    opt_options.draggable = false;
551  }
552  if (typeof opt_options.optimized === "undefined") {
553    opt_options.optimized = false;
554  }
555  opt_options.crossImage = opt_options.crossImage || "http" + (document.location.protocol === "https:" ? "s" : "") + "://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png";
556  opt_options.handCursor = opt_options.handCursor || "http" + (document.location.protocol === "https:" ? "s" : "") + "://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur";
557  opt_options.optimized = false; // Optimized rendering is not supported
558
559  this.label = new MarkerLabel_(this, opt_options.crossImage, opt_options.handCursor); // Bind the label to the marker
560
561  // Call the parent constructor. It calls Marker.setValues to initialize, so all
562  // the new parameters are conveniently saved and can be accessed with get/set.
563  // Marker.set triggers a property changed event (called "propertyname_changed")
564  // that the marker label listens for in order to react to state changes.
565  google.maps.Marker.apply(this, arguments);
566}
567
568inherits(MarkerWithLabel, google.maps.Marker);
569
570/**
571 * Overrides the standard Marker setMap function.
572 * @param {Map} theMap The map to which the marker is to be added.
573 * @private
574 */
575MarkerWithLabel.prototype.setMap = function (theMap) {
576
577  // Call the inherited function...
578  google.maps.Marker.prototype.setMap.apply(this, arguments);
579
580  // ... then deal with the label:
581  this.label.setMap(theMap);
582};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.