 # All the default editor tools for the pixel editor
 
 # Old school namespacing. Stuck with it until Sprockets supports exports
-window.Pixie ||= {}
-Pixie.Editor ||= {}
-Pixie.Editor.Pixel ||= {}
+namespace "Pixie.Editor.Pixel", (Pixel) ->
 
-Pixie.Editor.Pixel.tools = (($) ->
   # Import tools and actions from other files
   {
     config: {

      hotkeys: ['f', '6']
      mousedown: floodFill
      mouseenter: floodFill
)(jQuery)


      neighbors = canvas.getNeighbors(pixel.x, pixel.y)

      neighbors.each (neighbor) ->
        if neighbor?.color().equal(originalColor)
          neighbor.color(newColor)
          q.push(neighbor)
