Source: widgets/pointerselectablebutton.js

define('application/widgets/pointerselectablebutton', [
    'rofl/widgets/button',
    'rofl/events/pointerselectevent',
    'rofl/lib/utils',
    'application/decorators/buttonpress'
], function (
    Button,
    PointerSelectEvent,
    Utils,
    ButtonPressDecorator
) {
    'use strict';

    return Button.extend({

        /**
         * Initialises the pointer widget.
         *
         * @param {string} id - The id.
         */
        init: function init (id) {
            init.base.call(this, id);
            this.decorate([ButtonPressDecorator]);
            this.setDisabled(true);
        },

        /**
         * Handles the on click event.
         *
         * @param {Object} e - Event object.
         * @private
         */
        _onClickEvent: function (e) {
            var coordinates = this._getEventCoordinates(e);

            this._onButtonPress();

            this.bubbleEvent(new PointerSelectEvent(this,
                coordinates.x,
                coordinates.y));
        }
    });
});