简体   繁体   English

jsplumb:如何通过拖动连接器来创建新元素

[英]jsplumb: How to create new element by dragging connector

I have been customizing the jsplumb flowchart example. 我一直在自定义jsplumb流程图示例。 Currently, I can drag and create connectors between elements but I would like to now drag an element to a blank part of the screen (ie not an element) and catch that event. 目前,我可以在元素之间拖动并创建连接器,但是现在我想将元素拖动到屏幕的空白部分(即不是元素)并捕获该事件。 Does anyone know which one that would be? 有谁知道那是哪一个?

Instead of using jsPlumb.draggable, use jQuery draggable 而不是使用jsPlumb.draggable,而是使用jQuery draggable

$(".element").draggable({
                helper: 'clone',
                // appendTo: 'body',
                start: function(event, ui) {}, // console.log(event);console.log(ui)},
                stop: function(event, ui) {}, // console.log(event);//console.log(ui)},
                revert: 'invalid',
                cursor:'move',
                opacity: 0.5,
            });

API Docs - http://api.jqueryui.com/draggable/ API文件-http: //api.jqueryui.com/draggable/

start & stop are the events fired when the drag starts and stops respectively. startstop是分别在拖动开始和停止时触发的事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM