Skip to content

Instantly share code, notes, and snippets.

@jparish3
Last active August 29, 2015 14:16
Show Gist options
  • Save jparish3/8206a85f4434ec0f6031 to your computer and use it in GitHub Desktop.
Save jparish3/8206a85f4434ec0f6031 to your computer and use it in GitHub Desktop.
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../google-map/google-map-search.html">
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
box-sizing: border-box;
}
#core_tooltip {
left: 1070px;
top: 890px;
}
#core_scroll_header_panel {
width: 100%;
height: 100%;
left: 0px;
top: -10px;
position: absolute;
}
#core_toolbar {
color: rgb(241, 241, 241);
fill: rgb(241, 241, 241);
background-color: rgb(66, 133, 244);
}
#drawerPanel {
position: absolute;
top: 190px;
right: 0px;
bottom: 0px;
left: 0px;
width: 100%;
height: 100%;
}
#section {
box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 4px, rgba(0, 0, 0, 0.0980392) 0px 0px 3px;
background-color: rgb(250, 250, 250);
}
#section1 {
height: 100%;
box-sizing: border-box;
background-color: rgb(221, 221, 221);
}
#google_map {
width: 100%;
height: 100%;
display: block;
left: -6px;
top: 0px;
position: absolute;
}
#locationField, #controls {
left: 248px;
top: 120px;
position: absolute;
width: 350px;
height: 60px;
border: rgb(250, 250, 250);
background-color: rgb(244, 244, 244);
}
#core_icon_button1 {
background-color: rgb(255, 255, 255);
}
#input {
padding: 15px;
}
#google_map_search {
left: 104px;
top: 300px;
position: absolute;
}
#locationField {
left: 250px;
top: 120px;
position: absolute;
}
#navicon {
left: 208px;
top: 140px;
position: absolute;
}
</style>
<core-scroll-header-panel headermargin="128" condenses headerheight="192" id="core_scroll_header_panel">
<core-toolbar id="core_toolbar" class="tall">
<core-icon-button icon="arrow-back" id="core_icon_button"></core-icon-button>
<div id="div" flex></div>
<core-icon-button icon="more-vert" id="core_icon_button2"></core-icon-button>
<div id="div1" class="bottom indent">Search Places</div>
<core-field id="locationField" onload="initialize()" icon="search" theme="core-light-theme" center horizontal layout>
<google-maps-api apikey="{{ apiKey }}" libraries="{{ libraries }}" version="{{ version }}" id="google_maps_api" on-api-load="{{ mapApiLoaded }}"></google-maps-api>
<core-input id="core_input" value="{{ $.autocomplete.value }}" flex></core-input>
<core-icon-button icon="search" id="core_icon_button1" start-justified horizontal layout start></core-icon-button>
<input id="autocomplete" value="{{ $.core_input.value }}" placeholder="Enter your address first time" type="text" class="form-control" onfocus="geolocate()" is="core-input">
</core-field>
<paper-icon-button icon="menu" id="navicon" on-tap="{{ toggle }}" theme="core-light-theme"></paper-icon-button>
</core-toolbar>
<core-drawer-panel transition id="drawerPanel" touch-action>
<section id="section" drawer>
<core-menu selected="Roadmap" valueattr="label" selectedindex="0" id="core_menu" theme="core-light-theme">
<core-item id="core_item" icon="settings" label="Roadmap" on-tap="{{ showRoad }}" horizontal center layout active></core-item>
<core-item id="core_item1" icon="settings" label="Satellite" on-tap="{{ showSat }}" horizontal center layout></core-item>
</core-menu>
</section>
<section id="section1" main>
<google-map latitude="{{ $.google_map_search.result.latitude }}" longitude="{{ $.google_map_search.result.longitude }}" zoom="18" id="google_map"></google-map>
<google-map-search map="{{ $.google_map.map }}" query="{{ $.core_input.value }}" id="google_map_search"></google-map-search>
</section>
</core-drawer-panel>
</core-scroll-header-panel>
</template>
<script>
Polymer({
showRoad: function (){
this.$.google_map.mapType= 'roadmap';
},
showSat: function (){
this.$.google_map.mapType= 'satellite';
},
toggle: function() {
this.$.drawerPanel.togglePanel();
},
mapApiLoaded: function () {
this.autocomplete= new google.maps.places.Autocomplete(this.$.autocomplete);
google.maps.event.addListener(this.autocomplete, 'place_changed', function() {
var place = this.autocomplete.getPlace();
this.location=place.formatted_address
}.bind(this));
},
libraries: 'places',
version: '3.exp',
});
</script>
</polymer-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment