text: 
  function setOrigin(origin) {
    ORIGIN_X = origin.x;
    ORIGIN_Y = origin.y;
  }
  
  function moveCam(offset) {
    CAM_X = CENTER_X + offset.x;
    CAM_Y = HEIGHT   + offset.y;
    Layers.render(true);
  }
  
  function setSize(size) {
    WIDTH  = size.width;
    HEIGHT = size.height;
    CENTER_X = WIDTH /2 <<0;
    CENTER_Y = HEIGHT/2 <<0;
  
    CAM_X = CENTER_X;
    CAM_Y = HEIGHT;
  
    Layers.setSize(WIDTH, HEIGHT);
    MAX_HEIGHT = CAM_Z-50;
  }
  
  function setZoom(z) {
    ZOOM = z;
    MAP_SIZE = MAP_TILE_SIZE <<ZOOM;
  
    var center = pixelToGeo(ORIGIN_X+CENTER_X, ORIGIN_Y+CENTER_Y);
    var a = geoToPixel(center.latitude, 0);
    var b = geoToPixel(center.latitude, 1);
    PIXEL_PER_DEG = b.x-a.x;
  
    ZOOM_FACTOR = pow(0.95, ZOOM-MIN_ZOOM);
  
    WALL_COLOR_STR = ''+ WALL_COLOR.alpha(ZOOM_FACTOR);
    ALT_COLOR_STR  = ''+ ALT_COLOR.alpha( ZOOM_FACTOR);
    ROOF_COLOR_STR = ''+ ROOF_COLOR.alpha(ZOOM_FACTOR);
  }
  
  function onResize(e) {
    setSize(e);
    Layers.render();
    Data.update();
  }
  
  function onMoveEnd(e) {
    Layers.render();
    Data.update(); // => fadeIn() => Layers.render()
  }
  
  function onZoomStart() {
    isZooming = true;
  // effectively clears because of isZooming flag
  // TODO: introduce explicit clear()
    Layers.render();
  }
  
  function onZoomEnd(e) {
    isZooming = false;
    setZoom(e.zoom);
    Data.update(); // => fadeIn()
    Layers.render();
  }
  