Created
July 4, 2014 01:24
-
-
Save novascreen/e9ba8c1bcd92bcbbde61 to your computer and use it in GitHub Desktop.
designer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../core-scaffold/core-scaffold.html"> | |
<link rel="import" href="../core-header-panel/core-header-panel.html"> | |
<link rel="import" href="../core-menu/core-menu.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../google-map/google-map-search.html"> | |
<link rel="import" href="../paper-input/paper-input.html"> | |
<link rel="import" href="../core-menu/core-submenu.html"> | |
<link rel="import" href="../google-map/google-map.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
box-sizing: border-box; | |
} | |
#core_scaffold { | |
position: static; | |
top: 290px; | |
right: 0px; | |
bottom: 0px; | |
left: 480px; | |
} | |
#core_header_panel { | |
background-color: rgb(255, 255, 255); | |
} | |
#core_toolbar { | |
color: rgb(255, 255, 255); | |
background-color: rgb(255, 255, 255); | |
} | |
#core_menu { | |
font-size: 16px; | |
} | |
#google_map { | |
width: 100%; | |
height: 100%; | |
display: block; | |
position: static; | |
} | |
</style> | |
<core-scaffold id="core_scaffold"> | |
<core-header-panel mode="seamed" id="core_header_panel" navigation flex> | |
<core-toolbar id="core_toolbar"> | |
<google-map-search id="google_map_search"></google-map-search> | |
<paper-input label="Search for address" id="paper_input"></paper-input> | |
</core-toolbar> | |
<core-menu selected="Item1" valueattr="label" selectedindex="0" id="core_menu" theme="core-light-theme"> | |
<core-item label="Item1" icon="settings" id="core_item" horizontal center layout active></core-item> | |
<core-item label="Item2" icon="settings" id="core_item1" horizontal center layout></core-item> | |
</core-menu> | |
</core-header-panel> | |
<div id="div" tool>Title</div> | |
<google-map disabledefaultui id="google_map"> | |
<template repeat="{{markers}}"> | |
<google-map-marker latitude="{{latitude}}" longitude="{{longitude}}" title="{{index}}"></google-map-marker> | |
</template> | |
</google-map> | |
</core-scaffold> | |
</template> | |
<script> | |
Polymer('my-element', { | |
markers: [], | |
markersChanged: function () { | |
this.markers.forEach(function (marker, index) { | |
marker.index = index | |
}) | |
}, | |
ready: function () { | |
var self = this | |
this.mapEl = this.$.google_map | |
this.mapEl.addEventListener('google-map-ready', function(e) { | |
console.dir(self.mapEl) | |
self.whatever.call(self) | |
}) | |
}, | |
whatever: function () { | |
var self = this | |
this.mapsApi = this.mapEl.shadowRoot.querySelector('google-maps-api').api | |
this.map = this.mapEl.map | |
console.dir(this.mapsApi) | |
this.mapsApi.event.addListener(this.map, 'click', function (e) { | |
console.log(self, e) | |
self.addMarker.call(self, e.latLng.lat(), e.latLng.lng()) | |
}) | |
}, | |
addMarker: function (latitude, longitude) { | |
this.markers.push({ | |
latitude: latitude, | |
longitude: longitude | |
}) | |
} | |
}); | |
</script> | |
</polymer-element> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment