Skip to content

Instantly share code, notes, and snippets.

@hanafiah
Created March 4, 2014 16:06
Show Gist options
  • Save hanafiah/9349351 to your computer and use it in GitHub Desktop.
Save hanafiah/9349351 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
var loc = window.location.hash.substr(1);
//start position
context.beginPath();
context.arc(190, 450, 10, 0, 2 * Math.PI, false);
context.fillStyle = 'white';
context.lineWidth = 2;
context.strokeStyle = 'red';
context.stroke();
switch (loc)
{
case 'bke01':
context.strokeText('BKE01', 70, 330);
context.beginPath();
context.rect(50, 300, 100, 50);
context.stroke();
//draw route
context.beginPath();
context.moveTo(150, 325);
context.lineTo(160, 325);
context.lineTo(160, 450);
context.lineTo(180, 450);
context.lineWidth = 2;
context.stroke();
break;
case 'bke02':
context.strokeText('BKE02', 70, 280);
context.beginPath();
context.rect(50, 250, 100, 50);
context.stroke();
//draw route
context.beginPath();
context.moveTo(150, 275);
context.lineTo(160, 275);
context.lineTo(160, 450);
context.lineTo(180, 450);
context.lineWidth = 2;
context.stroke();
break;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment