'use strict';
/**
*
* @param editor
* @constructor
*/
SUXESS.ImageTool = function(editor) {
SUXESS.Tool.call(this, editor);
this._domAttributes.element = '<div>Image</div>';
this.setAction(function(canvas, position) {
this._editor._angApi.imageSelection.call().then(
function(result){
var e = new SUXESS.Element();
e.setImage(result);
e.setState({
position: position,
width: result.resolution[0],
height: result.resolution[1]
});
this._editor.addElement(e);
canvas.append(e.render());
SUXESS.eventManager.emit( 'suxess:element-added' );
}.bind(this),
function(cancel){
console.log(cancel);
}
);
});
};
SUXESS.ImageTool.prototype = Object.create( SUXESS.Tool.prototype );
SUXESS.ImageTool.constructor = SUXESS.ImageTool;