Source: suxess/mockup-editor/tools/tool.js

'use strict';

/**
 *
 * @param editor
 * @constructor
 */
SUXESS.Tool = function(editor) {
    SUXESS.Renderable.call(this, {
      class: ['tool', 'ui-widget-content'],
    });

    this._editor = editor;
};

SUXESS.Tool.prototype = Object.create( SUXESS.Renderable.prototype );
SUXESS.Tool.constructor = SUXESS.Tool;

/**
 *
 * @returns {DOM}
 */
SUXESS.Tool.prototype.render = function() {
    var elm = SUXESS.Renderable.prototype.render.call(this);

    $(elm).draggable({
      revert: true,
      helper: 'clone',
    });

    return elm;
};

/**
 *
 * @param action
 */
SUXESS.Tool.prototype.setAction = function(action) {
    this._action = action;
};

/**
 *
 * @param element
 * @param position
 * @returns {*}
 */
SUXESS.Tool.prototype.triggerAction = function(element, position) {
    return this._action(element, position);
};