/**
 * This module knows how to add an image to canvas
 */
define(function(require){

  var defineComponent = require("flight/lib/component");

  return defineComponent(imageCanvas);

  function imageCanvas(){

    this.defaultAttrs({
      canvas: undefined,
    });

    this.after("initialize", function(){
      this.attachEventListeners();
    });

    this.attachEventListeners = function(){
      this.on("addingImageInitted", function(e, data){
        this.addImages(data.canvas, data.images, data.cfg);
      });

    };

    // TODO I believe this sucks so much
    this.addImages = function(canvas, images, cfg){
      this.attr.canvas = canvas;

      var reader = new FileReader();

      reader.onload = function(e){
        var img = new Image();

        img.onload = function(){
          var image = new fabric.Image(img);
          console.log(cfg);
          image.set({
            top: cfg.y + cfg.height / 2,
            left: cfg.x + cfg.width / 2,
            width: cfg.width,
            height: cfg.height
          });

          canvas.add(image).renderAll();

        };

        img.src = e.target.result;    
      };

      reader.readAsDataURL(images[0]);
    };
  }

});
@@ -529,49 +529,8 @@
 %7D;%0A%0A
-    // TODO I believe this sucks so much%0A
     
@@ -542,16 +542,23 @@
 addImage
+ToCanva
 s = func
@@ -579,17 +579,16 @@
 mage
-s
 , cfg)%7B%0A
     
@@ -587,42 +587,8 @@
 g)%7B%0A
-      this.attr.canvas = canvas;%0A%0A
     
@@ -1113,14 +1113,215 @@
 mage
-s%5B0%5D);
+);%0A    %7D;%0A%0A    this.addImages = function(canvas, images, cfg)%7B%0A      this.attr.canvas = canvas;%0A%0A      for (var i = 0; i %3C images.length; i++) %7B%0A        this.addImageToCanvas(canvas, images%5Bi%5D, cfg);%0A      %7D
 %0A   

use another method