0
사용자가 도구 상자에서 요소를 끌어서 캔버스에 놓은 다음 서로 연결할 수있는 간단한 UI를 만들었습니다. 하지만 각 연결 지점 (요소의 왼쪽 모서리에 흰색 사각형), 고유 한 ID를 부여한 후 연결을 만들려고하면 연결선이 캔버스의 다른 곳에서 시작되어 아래와 같이 연결되지 않습니다. 곧 마우스를 놓으면 커넥터 줄이 사라집니다.jsPlumb에서 요소 간 연결 만들기
여기서 I는 요소 삭제 관련된 CSS에 간단한 변경은 모든 차이를 만들어
function dropCompleteElement(newAgent,i,e,kind)
{
$(droppedElement).draggable({containment: "container"});
var finalElement = newAgent;
r++; q++;
if(kind=="import")
{
var connection = $('<div>').attr('id', i + '-import').addClass('connection');
}
else if (kind=="export")
{
var connection = $('<div>').attr('id', i + '-export').addClass('connection');
}
else
{
var connection = $('<div>').attr('id', i + '-defined').addClass('connection');
}
finalElement.css({
'top': e.pageY,
'left': e.pageX
});
finalElement.append(connection);
$('#container').append(finalElement);
jsPlumb.draggable(finalElement, {
containment: 'parent'
});
jsPlumb.makeTarget(connection, {
anchor: 'Continuous'
});
jsPlumb.makeSource(connection, {
anchor: 'Continuous'
});
$("#container").removeClass("disabledbutton");
$("#toolbox").removeClass("disabledbutton");
var myNode = document.getElementById("lot");
var fc = myNode.firstChild;
while(fc) {
myNode.removeChild(fc);
fc = myNode.firstChild;
}
$(".toolbox-titlex").hide();
$(".panel").hide();
}