 {logger} = require "../../common/logging"
 
 class TileRendererView extends PlotWidget
-  
-  bind_bokeh_events: () ->
-    @listenTo(@model, 'change', @request_render)
 
   get_extent: () ->
     return [@x_range.get('start'), @y_range.get('start'), @x_range.get('end'), @y_range.get('end')]

    @map_canvas.restore()

  _prefetch_tiles: () =>
    extent = @get_extent()
    zoom_level = @mget('tile_source').get_level_by_extent(extent, @map_frame.get('height'), @map_frame.get('width'))
    tiles = @mget('tile_source').get_tiles_by_extent(extent, zoom_level)
    for t in [0..Math.min(10, tiles.length)] by 1
      [x, y, z, bounds] = t
      children = @mget('tile_source').children_by_tile_xyz(x, y, z)
      for c in children
        [cx, cy, cz, cbounds] = c
        if @mget('tile_source').tile_xyz_to_key(cx, cy, cz) of @mget('tile_source').tiles
          continue
        else
          @_create_tile(cx, cy, cz, cbounds, true)

      @_set_data()
      @_map_data()
      @map_initialized = true

    # brute force way of handling resize or responsive event -------------------------------------------------------------
    if @height != @map_frame.get('height') or @width != @map_frame.get('width')
      extent = @get_extent()
      zoom_level = @mget('tile_source').get_level_by_extent(extent, @map_frame.get('height'), @map_frame.get('width'))
      new_extent = @mget('tile_source').snap_to_zoom(extent, @map_frame.get('height'), @map_frame.get('width'), zoom_level)
      @x_range.set({start:new_extent[0], end: new_extent[2]})
      @y_range.set({start:new_extent[1], end: new_extent[3]})
      @extent = new_extent
      @height = @map_frame.get('height')
      @width = @map_frame.get('width')
      return

    @_update()

