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