Last active
January 28, 2017 12:14
-
-
Save Vallabharayudu/1c9b271bc4821e6c26d6c0ad25ca3b85 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<template> | |
<require from="styles.css"></require> | |
<div> | |
<div class="left"> | |
<div> | |
<button class="btn btn-primary blueButton">New York Bridge</button> | |
</div> | |
<div> | |
<button class="btn btn-primary blueButton">New York Bridge</button> | |
</div> | |
<div> | |
<button class="btn btn-primary blueButton">New York Bridge</button> | |
</div> | |
</div> | |
<div class="right imgOgStaticMap"> | |
<img src="${url}"/> | |
</div> | |
<div class="clear"></div> | |
</div> | |
</template> |
This file contains hidden or 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
export class App{ | |
constructor(){ | |
this.mapLat = 40.757715; | |
this.mapLang = -73.98152829999998; | |
this.address = 'Brooklyn Bridge,New York,NY'; | |
this.address2 = this.address.replace(' ','+'); | |
this.markerlat = 40.711614; | |
this.markerLang = -74.01231; | |
//this.url = 'https://maps.googleapis.com/maps/api/staticmap?center='+this.mapLat+','+this.mapLang+'&zoom=12&size=200x200&key='; | |
this.url = 'https://maps.googleapis.com/maps/api/staticmap?center='+this.address2+'&zoom=12&size=200x200&markers=color:green%7Clabel:G%7C'+this.markerlat+','+this.markerLang+'&key='; | |
this.srcpath = this.toDataUrl(this.url, function(base64Img) { | |
console.log(base64Img); | |
//return base64Img; | |
}); | |
//this.srcpath = base64Img; | |
} | |
toDataUrl(src, callback, outputFormat) { | |
var img = new Image(); | |
img.crossOrigin = 'Anonymous'; | |
img.onload = function() { | |
var canvas = document.createElement('CANVAS'); | |
var ctx = canvas.getContext('2d'); | |
var dataURL; | |
canvas.height = this.height; | |
canvas.width = this.width; | |
ctx.drawImage(this, 0, 0); | |
dataURL = canvas.toDataURL(outputFormat); | |
callback(dataURL); | |
}; | |
img.src = src; | |
if (img.complete || img.complete === undefined) { | |
img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; | |
img.src = src; | |
} | |
} | |
} |
This file contains hidden or 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
<!doctype html> | |
<html> | |
<head> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
<!--<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script> | |
<script> | |
require(['aurelia-bootstrapper']); | |
</script>--> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
This file contains hidden or 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
/* todo: add styles */ | |
.orgMap{ | |
height:200px; | |
width:400px; | |
margin:0 auto; | |
border:1px solid #b7b7b7; | |
padding:20px; | |
font-weight:bold; | |
} | |
.left{ | |
float:left; | |
} | |
.right{ | |
float:right; | |
} | |
.clear{ | |
clear:both; | |
} | |
.blueButton{ | |
margin:10px auto; | |
background:#0183d7; | |
color:#fff; | |
padding:4px 12px; | |
height:30px; | |
} | |
.imgOgStaticMap{ | |
border:1px solid red; | |
width:200px; | |
height:200px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment