Skip to content

Commit

Permalink
Merge pull request #97 from DracoNoir/feature-marker-zIndex
Browse files Browse the repository at this point in the history
Adds support to google-map-marker for zIndex option
  • Loading branch information
ebidel committed Feb 5, 2015
2 parents 8494430 + 358e3a6 commit 16a2e72
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
20 changes: 18 additions & 2 deletions google-map.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
@event google-map-marker-rightclick
@param {google.maps.MouseEvent} event The mouse event.
-->
<polymer-element name="google-map-marker" attributes="clickEvents icon mouseEvents">
<polymer-element name="google-map-marker" attributes="clickEvents icon mouseEvents zIndex">
<template>
<style>
:host {
Expand Down Expand Up @@ -159,6 +159,15 @@
*/
mouseEvents: false,

/**
* Z-index for the marker icon.
*
* @attribute zIndex
* @type number
* @default 0
*/
zIndex: 0,

publish: {
/**
* The marker's longitude coordinate.
Expand Down Expand Up @@ -242,6 +251,12 @@
}
},

zIndexChanged: function() {
if (this.marker) {
this.marker.setZIndex(this.zIndex);
}
},

mapChanged: function() {
// Marker will be rebuilt, so disconnect existing one from old map and listeners.
if (this.marker) {
Expand Down Expand Up @@ -284,7 +299,8 @@
title: this.title,
draggable: this.draggable,
visible: !this.hidden,
icon: this.icon
icon: this.icon,
zIndex: this.zIndex
});
this.contentChanged();
this.clickEventsChanged();
Expand Down
5 changes: 4 additions & 1 deletion test/marker-basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
test.skip('properties');

// TODO: add test for drag and drop marker.
test('dragdrop marker', function() {
test('dragdrop marker', function() {
});
test.skip('dragdrop marker');

Expand All @@ -41,6 +41,7 @@
assert.isNull(markerEl.map);
assert.isNull(markerEl.icon);
assert.isNull(markerEl.info);
assert.equal(markerEl.zIndex, 0);
assert.equal(markerEl.latitude, 37.779);
assert.equal(markerEl.longitude, -122.3892);
assert.isNull(markerEl.offsetParent,
Expand All @@ -52,13 +53,15 @@
var markerEl = map.children[0];
markerEl.latitude = 37.77493;
markerEl.longitude = -122.41942;
markerEl.zIndex = 1;

assert.equal(
markerEl.map, map.map, "marker's map is not the google-map's");

asyncPlatformFlush(function() {
assert.equal(markerEl.marker.getPosition().lat(), markerEl.latitude);
assert.equal(markerEl.marker.getPosition().lng(), markerEl.longitude);
assert.equal(markerEl.marker.getZIndex(), markerEl.zIndex);

markerEl.icon = 'https://www.google.com/images/srpr/logo11w.png';
asyncPlatformFlush(function() {
Expand Down

0 comments on commit 16a2e72

Please sign in to comment.