How to use the jsplumb.Connectors function in jsplumb

To help you get started, we’ve selected a few jsplumb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oroinc / platform / src / Oro / Bundle / WorkflowBundle / Resources / public / js / tools / jsplumb-smartline.js View on Github external
if (fns.hasOwnProperty(k)) {
                    child.prototype[k] = _makeFn(k, fns[k]);
                }
            }
        };

        if (arguments.length > 2) {
            for (i = 2; i < arguments.length; i++) {
                _oneSet(arguments[i]);
            }
        }

        return child;
    }

    juExtend(Smartline, jsPlumb.Connectors.AbstractConnector);
    jsPlumb.registerConnectorType(Smartline, 'Smartline');
    _.each(jsPlumb.getRenderModes(), function(renderer) {
        jsPlumb.Connectors[renderer].Smartline = function() {
            Smartline.apply(this, arguments);
            jsPlumb.ConnectorRenderers[renderer].apply(this, arguments);
        };
        juExtend(jsPlumb.Connectors[renderer].Smartline, [Smartline, jsPlumb.ConnectorRenderers[renderer]]);
    });

    return Smartline;
});
github oroinc / platform / src / Oro / Bundle / WorkflowBundle / Resources / public / js / tools / jsplumb-smartline.js View on Github external
function Smartline(params) {
        this.type = 'Smartline';
        this.idPrefix = 'smartline-connector-';
        params = params || {};
        params.stub = params.stub === null || params.stub === void 0 ? 30 : params.stub;
        var segments;
        var _super = jsPlumb.Connectors.AbstractConnector.apply(this, arguments);
        this.smartlineManager = ensureSmartLineManager(params._jsPlumb);
        var midpoint = params.midpoint === null || params.midpoint === void 0 ? 0.5 : params.midpoint;
        var alwaysRespectStubs = params.alwaysRespectStubs === true;
        var userSuppliedSegments = null;
        var lastx = null;
        var lasty = null;
        var cornerRadius = params.cornerRadius !== null && params.midpoint !== void 0 ? params.cornerRadius : 0;
        var sgn = function(n) {
            return n < 0 ? -1 : n === 0 ? 0 : 1;
        };
        /**
         * helper method to add a segment.
         */
        var addSegment = function(segments, x, y, paintInfo) {
            if (lastx === x && lasty === y) {
                return;