2
使用與Overlapping Marker Spiderfier和MarkerWithLabel谷歌地圖的JavaScript API V3 spiderfying當有不利影響。重疊標記Spiderfier + MarkerWithLabel
也就是說,標記事件position_changed
在spiderfying之後被觸發另外的n - 1
次,其中n
是spiderfied的標記的數量。
使用與Overlapping Marker Spiderfier和MarkerWithLabel谷歌地圖的JavaScript API V3 spiderfying當有不利影響。重疊標記Spiderfier + MarkerWithLabel
也就是說,標記事件position_changed
在spiderfying之後被觸發另外的n - 1
次,其中n
是spiderfied的標記的數量。
問題從optimized
標記屬性,它MarkerWithLabel力量假莖。如果將optimized
設置爲true(默認設置),則會導致正確的Spiderfying。這樣做需要一塊膏藥貼在MarkerWithLabel source雖然:去除設置optimized = false
行:
function MarkerWithLabel(opt_options) {
opt_options = opt_options || {};
opt_options.labelContent = opt_options.labelContent || "";
opt_options.labelAnchor = opt_options.labelAnchor || new google.maps.Point(0, 0);
opt_options.labelClass = opt_options.labelClass || "markerLabels";
opt_options.labelStyle = opt_options.labelStyle || {};
opt_options.labelInBackground = opt_options.labelInBackground || false;
if (typeof opt_options.labelVisible === "undefined") {
opt_options.labelVisible = true;
}
if (typeof opt_options.raiseOnDrag === "undefined") {
opt_options.raiseOnDrag = true;
}
if (typeof opt_options.clickable === "undefined") {
opt_options.clickable = true;
}
if (typeof opt_options.draggable === "undefined") {
opt_options.draggable = false;
}
// if (typeof opt_options.optimized === "undefined") {
// opt_options.optimized = false;
// }
opt_options.crossImage = opt_options.crossImage || "http" + (document.location.protocol === "https:" ? "s" : "") + "://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png";
opt_options.handCursor = opt_options.handCursor || "http" + (document.location.protocol === "https:" ? "s" : "") + "://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur";
// opt_options.optimized = false; // Optimized rendering is not supported
this.label = new MarkerLabel_(this, opt_options.crossImage, opt_options.handCursor); // Bind the label to the marker
// Call the parent constructor. It calls Marker.setValues to initialize, so all
// the new parameters are conveniently saved and can be accessed with get/set.
// Marker.set triggers a property changed event (called "propertyname_changed")
// that the marker label listens for in order to react to state changes.
google.maps.Marker.apply(this, arguments);
}
非常感謝..我有類似的問題,現在是工作的罰款.. – 2015-02-09 11:12:37