Download
Demo
- Overview
- Documents
User Rating: 4.5/5 ( 1 votes)
Your Rating:
A RichMarker that allows any HTML/DOM to be added to a map and be draggable.
Example:
marker = new RichMarker({ position: mapCenter, map: map, draggable: true, content: '<div class="my-marker"><div>This is a nice image</div>' + '<div><img src="http://farm4.static.flickr.com/3212/3012579547_' + '097e27ced9_m.jpg"/></div><div>You should drag it!</div></div>' }); var div = document.createElement('DIV'); div.innerHTML = '<div class="my-other-marker">I am flat marker!</div>'; marker2 = new RichMarker({ map: map, position: new google.maps.LatLng(30, 50), draggable: true, flat: true, anchor: RichMarkerPosition.MIDDLE, content: div }); google.maps.event.addListener(marker, 'position_changed', function() { log('Marker position: ' + marker.getPosition()); }); google.maps.event.addDomListener(document.getElementById('set-content'), 'click', function() { setMarkerContent(); }); google.maps.event.addDomListener(document.getElementById('toggle-map'), 'click', function() { toggleMap(); }); google.maps.event.addDomListener(document.getElementById('toggle-anchor'), 'click', function() { toggleAnchor(); }); google.maps.event.addDomListener(document.getElementById('toggle-flat'), 'click', function() { toggleFlat(); }); google.maps.event.addDomListener(document.getElementById('toggle-visible'), 'click', function() { toggleVisible(); }); google.maps.event.addDomListener(document.getElementById('toggle-draggable'), 'click', function() { marker.setDraggable(!marker.getDraggable()); }); }
class RichMarker
This class extends google.maps.OverlayView.
Constructor
Constructor | Description |
---|---|
RichMarker(opt_options:Object.<string|*>) | A RichMarker that allows any HTML/DOM to be added to a map and be draggable. |
Methods
Methods | Return Value | Description |
---|---|---|
anchor_changed() | None | Anchor changed event. |
content_changed() | None | Sets the marker content and adds loading events to images. |
drag(e:Event) | None | Handles the drag event. |
draggable_changed() | None | Draggable property changed callback. |
draw() | None | Impelementing the interface. |
flat_changed() | None | Flat changed event. |
getAnchor() | google.maps.Size | Gets the anchor. |
getContent() | string|Node | Get the content of the marker. |
getDraggable() | boolean | Whether the marker is draggable or not. |
getFlat() | boolean | If the makrer is flat or not. |
getPosition() | google.maps.LatLng | Gets the postiton of the marker. |
getHeight() | Number | Gets the height of the marker. |
getShadow() | string | Gets the marker's box shadow. |
getVisible() | boolean | Returns the current visibility state of the marker. |
getWidth() | Number | Gets the width of the marker. |
getZIndex() | Number | Gets the zIndex of the marker. |
onAdd() | None | Adding the marker to a map. Implementing the interface. |
onRemove() | None | Removing a marker from the map. Implementing the interface.. |
position_changed() | None | Position changed event. |
setAnchor(anchor:RichMarkerPosition|google.maps.Size) | None | Position changed event. |
setContent(content:string|Node) | None | Sets the content of the marker. |
setDraggable(draggable:boolean) | None | Sets the marker to be draggable or not. |
setFlat(flat:boolean) | None | Sets the marker to be flat. |
setPosition(position:google.maps.LatLng) | None | Sets the position of the marker. |
setShadow(shadow:string) | None | Sets the marker's box shadow. |
setVisible(visible:boolean) | None | Sets the visiblility state of the marker. |
setZIndex(index:Number) | None | Sets the zIndex of the marker. |
startDrag(e:Event) | None | Start dragging. |
stopDrag() | None | Stop dragging. |
visible_changed() | None | The visible changed event. |
zIndex_changed() | None | zIndex changed event. |
Events
Events | Arguments | Description |
---|---|---|
anchor_changed | None | This event is fired when the anchor property changes. |
click | Event | This event is fired when the marker was clicked. |
content_changed | None | This event is fired when the content property changes. |
draggable_changed | None | This event is fired when the draggable property changes. |
flat_changed | None | This event is fired when the flat property changes. |
height_changed | None | This event is fired when the height property changes. |
position_changed | None | This event is fired when the position property changes. |
ready | None | This event is fired when the marker is ready to interact with. |
visible_changed | None | This event is fired when the visible property changes. |
width_changed | None | This event is fired when the width property changes. |
zIndex_changed | None | This event is fired when the zIndex property changes. |