client/js/renderer/nodelinkbutton.js
author rougeronj
Tue, 05 May 2015 17:59:14 +0200
changeset 445 705a2e9c6c9d
parent 434 0d5998b32a7c
child 449 aae670254c49
permissions -rw-r--r--
Add popup_editor and editor_panel option to allow the editor panel to bin in an external div Update the scene, the node editor and the edge editor to include the options


define(['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
    'use strict';

    var Utils = requtils.getUtils();

    /* NodeLinkButton Begin */

    //var NodeLinkButton = Renderer.NodeLinkButton = Utils.inherit(Renderer._NodeButton);
    var NodeLinkButton = Utils.inherit(NodeButton);

    _(NodeLinkButton.prototype).extend({
        _init: function() {
            this.type = "Node-link-button";
            this.lastSectorInner = 0;
            this.startAngle = 90;
            this.endAngle = 180;
            this.imageName = "link";
            this.text = "Link to another node";
        },
        mousedown: function(_event, _isTouch) {
            if (this.renderer.isEditable()) {
                var _off = this.renderer.canvas_$.offset(),
                _point = new paper.Point([
                                          _event.pageX - _off.left,
                                          _event.pageY - _off.top
                                          ]);
                this.renderer.click_target = null;
                this.renderer.removeRepresentationsOfType("editor");
                this.renderer.addTempEdge(this.source_representation, _point);
            }
        }
    }).value();

    /* NodeLinkButton End */

    return NodeLinkButton;

});