function allowedTools()

in modules/ui/top_toolbar.js [83:172]


    function allowedTools() {

        var mode = context.mode();
        if (!mode) return [];

        var tools;

        if (mode.id === 'save') {

            tools = [
                toolbox,
                'spacer',
                cancelSave
            ];

        } else if (mode.id === 'select' &&
            !mode.newFeature() &&
            mode.selectedIDs().every(function(id) {
                return context.graph().hasEntity(id);
            })) {

            tools = [
                toolbox,
                'spacer',
                /*
                deselect,
                'spacer',
                */
                centerZoom,
                'spacer',
                straighten,
                orthogonalize,
                circularize,
                reverse,
                split,
                disconnect,
                extract,
                merge,
                continueTool,
                'spacer',
                downgrade,
                deleteTool,
                'spacer',
                undoRedo,
                save
            ];

        } else if (mode.id === 'add-point' || mode.id === 'add-line' || mode.id === 'add-area' ||
            mode.id === 'draw-line' || mode.id === 'draw-area') {

            tools = [
                toolbox,
                addingGeometry,
                'spacer',
                structure,
                powerSupport,
                'spacer',
                waySegments,
                'spacer',
                repeatAdd,
                undoRedo,
                stopDraw
            ];

        } else {

            tools = [
                toolbox,
                'spacer',
                centerZoom,
                'spacer',
                addFeature,
                addAddable,
                addGeneric,
                addFavorite,
                addRecent,
                'spacer',
                notes,
                'spacer',
                undoRedo,
                save
            ];
        }

        tools = tools.filter(function(tool) {
            return !tool.allowed || tool.allowed();
        });

        return tools;
    }