From 1b74ab4b4513854bc27150d45235702e9932375a Mon Sep 17 00:00:00 2001 From: Michael Writhe Date: Wed, 13 Apr 2011 14:45:24 -0600 Subject: [PATCH] Added the spawn button --- web_assets/functions.js | 31 +++++++++++++++++++++++++++++++ web_assets/style.css | 7 +++++++ 2 files changed, 38 insertions(+) diff --git a/web_assets/functions.js b/web_assets/functions.js index 6c9bda7..6cc1efb 100644 --- a/web_assets/functions.js +++ b/web_assets/functions.js @@ -77,6 +77,31 @@ function createDropDown(title, items) { } } +function HomeControl(controlDiv, map) { + + controlDiv.style.padding = '5px'; + + // Set CSS for the control border + var controlUI = document.createElement('DIV'); + control.id='customControl'; + //controlUI.className='controlUI'; + controlUI.title = 'Click to set the map to Spawn'; + controlDiv.appendChild(controlUI); + + // Set CSS for the control interior + var controlText = document.createElement('DIV'); + //controlText.className='controlText'; + controlText.innerHTML = 'Spawn'; + controlUI.appendChild(controlText); + + // Setup the click event listeners: simply set the map to map center as definned below + google.maps.event.addDomListener(controlUI, 'click', function() { + map.panTo(defaultCenter); + }); + +} + + // need to define the controls including the compass and layer controls. top right! // input variables are for chumps... and reusable functions. this is neither. function drawMapControls() { @@ -96,6 +121,12 @@ function drawMapControls() { compassDiv.index = 0; // add it to the map, top right. map.controls[google.maps.ControlPosition.TOP_RIGHT].push(compassDiv); + + // Spawn button + var homeControlDiv = document.createElement('DIV'); + var homeControl = new HomeControl(homeControlDiv, map); + homeControlDiv.index = 1; + map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv); // only need to create the control if there are items in the list. as definned in config.js diff --git a/web_assets/style.css b/web_assets/style.css index 32389bf..8585eb3 100644 --- a/web_assets/style.css +++ b/web_assets/style.css @@ -40,6 +40,13 @@ body { height: 100%; margin: 0px; padding: 0px ; background-color: #000; } display: none; } +#customControl > div#button { + border: 1px solid #000; + font-size: 12px; + background-color: #fff; + display: none; +} + #link { background-color: #fff; /* fallback */