/**
 * Created with JetBrains WebStorm.
 * User: dfwang
 * Date: 14-6-16
 * Time: 下午12:02
 * To change this template use File | Settings | File Templates.
 */
define(function (require, exports) {
    var _a_$talign = require('editor/assert/js/utils/textfiledstyle').instance;
    var _$comm =   require('editor/assert/js/utils/commands')._$comm
    var _h_$text = function(){
        this.canvas=null;
        this.dom = null;
    };
    _h_$text.prototype.addElemet=function(_json){
        if(!PAGECURRENT){
            throw (new Error('no page'));
            return;
        }
        if(!_json)
        {
            this.dom =new fabric.TextFeild('请输入内容',{
                left:100,
                top:100
            });
            PAGECURRENT.c.activeObject = this;
            this.dom.baseClass= this;
            this.canvas = PAGECURRENT.c._canvas
            PAGECURRENT.c.add(this.dom);
        }else
        {
            this.dom =_json;
            PAGECURRENT.c.activeObject = this;
            this.dom.baseClass= this;
            this.canvas = PAGECURRENT.c._canvas;
            this.showProperty();
        }

    }

    if(_a_$talign)
    {
        _$comm._extend(_h_$text,_a_$talign);
    }
    exports.instance = _h_$text;
})
