client/js/renderer/noderevertbutton.js
author rougeronj
Tue, 22 Sep 2015 15:14:10 +0200
changeset 543 5f7bebdcfc0d
parent 434 0d5998b32a7c
permissions -rw-r--r--
Improve the way we init the view. The data loader send a "loaded" event, hooked by the scene.py and initializing the backbone.history and the view. We don't use redraw_active in save-once and full-json, because it was making the view initialization dependent of these file which are externals. Small fix to hide the "set saved view" button when there is only one view.


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

    var Utils = requtils.getUtils();

    /* NodeRevertButton Begin */

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

    _(NodeRevertButton.prototype).extend({
        _init: function() {
            this.type = "Node-revert-button";
            this.lastSectorInner = 0;
            this.startAngle = -135;
            this.endAngle = 135;
            this.imageName = "revert";
            this.text = "Cancel deletion";
        },
        mouseup: function() {
            this.renderer.click_target = null;
            this.renderer.is_dragging = false;
            if (this.renderer.isEditable()) {
                this.source_representation.model.unset("delete_scheduled");
            }
        }
    }).value();

    /* NodeRevertButton End */

    return NodeRevertButton;

});