Remember dimming/sharpening preferences
[potlatch2.git] / net / systemeD / halcyon / Map.as
index 4aae32a..59f93e6 100644 (file)
@@ -116,12 +116,17 @@ package net.systemeD.halcyon {
                // ------------------------------------------------------------------------------------------
                // Initialise map at a given lat/lon
 
-        public function init(startlat:Number,startlon:Number,startscale:uint=0):void {
+        public function init(startlat:Number, startlon:Number, startscale:uint=0):void {
                        while (numChildren) { removeChildAt(0); }
 
                        tileset=new TileSet(this);                                      // 0 - 900913 background
+                       if (initparams['tileblocks']) {                         //   | option to block dodgy tile sources
+                               tileset.blocks=initparams['tileblocks'];//   |
+                       }                                                                                       //   |
                        addChild(tileset);                                                      //   |
-                       tileset.init(tileparams);                                       //   |
+                       tileset.init(tileparams, false, 
+                                    initparams['background_dim']    ==null ? true  : initparams['background_dim'],
+                                    initparams['background_sharpen']==null ? false : initparams['background_sharpen']);
 
                        vectorbg = new Sprite();                                        // 1 - vector background layers
                        addChild(vectorbg);                                                     //   |
@@ -147,10 +152,12 @@ package net.systemeD.halcyon {
             this.dispatchEvent(new Event(MapEvent.INITIALISED));
                        download();
 
-            ExternalInterface.addCallback("setPosition", function (lat:Number,lon:Number,zoom:uint):void {
-                updateCoordsFromLatLon(lat, lon);
-                changeScale(zoom);
-            });
+            if (ExternalInterface.available) {
+              ExternalInterface.addCallback("setPosition", function (lat:Number,lon:Number,zoom:uint):void {
+                  updateCoordsFromLatLon(lat, lon);
+                  changeScale(zoom);
+              });
+            }
         }
 
                // ------------------------------------------------------------------------------------------
@@ -379,10 +386,18 @@ package net.systemeD.halcyon {
                public function setDimming(dim:Boolean):void {
                        if (tileset) { tileset.setDimming(dim); }
                }
+               public function getDimming():Boolean {
+                       if (tileset) { return tileset.getDimming(); }
+                       return true;
+               }
 
                public function setSharpen(sharpen:Boolean):void {
                        if (tileset) { tileset.setSharpen(sharpen); }
                }
+               public function getSharpen():Boolean {
+                       if (tileset) { return tileset.getSharpen(); }
+                       return false;
+               }
 
                // ------------------------------------------------------------------------------------------
                // Export (experimental)