client/js/renderer/nodehidebutton.js
author rougeronj
Wed, 20 May 2015 10:36:37 +0200
changeset 449 aae670254c49
child 453 04b7d46e9d67
permissions -rw-r--r--
add a hidebutton to the nodes buttons remove the "hidden" attribute from the node model. It is the view which controls the hidden nodes with a array of Hidden Nodes


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

    var Utils = requtils.getUtils();

    /* NodeRemoveButton Begin */

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

    _(NodeHideButton.prototype).extend({
        _init: function() {
            this.type = "Node-hide-button";
            this.lastSectorInner = 0;
            this.startAngle = 60;
            this.endAngle = 120;
            this.imageName = "hide";
            this.text = "Hide";
        },
        mouseup: function() {
            this.renderer.click_target = null;
            this.renderer.is_dragging = false;
            this.renderer.removeRepresentationsOfType("editor");
            if (this.renderer.isEditable()) {
                this.renderer.addHiddenNode(this.source_representation.model);
            }
        }
    }).value();

    /* NodeRemoveButton End */

    return NodeHideButton;

});