gpt4 book ai didi

javascript - jsPlumb 的流程图

转载 作者:行者123 更新时间:2023-12-02 19:01:52 27 4
gpt4 key购买 nike

我正在尝试使用 jsPlumb 创建流程图。我有两个元素,我想用一条线连接它们。我想要一条线,但不是像我现在拥有的一个大点。我已经尝试在任何可以设置的地方设置点的半径,但它似乎不受影响并且保持默认的 20px。我做错了什么?

<div id="start">Start</div>
<div id="msgtype">Lorem ipsum dolor sit amet</div>

jsPlumb.importDefaults({
Endpoints : [ [ 'Dot', {radius:1} ], [ 'Dot', { radius:1 } ]]
});
var connectorPaintStyle = {
lineWidth:4,
fillStyle:'#333333',
joinstyle:'round',
outlineWidth:0,
radius: 1,
}
var eleStart = jsPlumb.addEndpoint('start', {
isSource:true,
isTarget:false
});

var eleMsgtypeTop = jsPlumb.addEndpoint('msgtype', {
isTarget:true,
parameters:{
endpoint:'dot',
radius: 1
},
anchor: 'TopCenter',
radius: 1,
connectorStyle:connectorPaintStyle
});
jsPlumb.connect({ source:eleStart,
target:eleMsgtypeTop,
connectorStyle:connectorPaintStyle,
endpoint:[ 'Dot', { radius:1, hoverClass:'myEndpointHover' }],
connectorStyle:connectorPaintStyle
});

制作这个:

[]

JSFiddle Demo

最佳答案

试试这个:http://jsfiddle.net/GT884/1/

 ;(function () {

window.jsPlumbDemo = {

init: function () {

jsPlumb.importDefaults({
DragOptions: {
cursor: "pointer",
zIndex: 2000
},
HoverClass: "connector-hover"
});

var connectorStrokeColor = "rgba(50, 50, 200, 1)",
connectorHighlightStrokeColor = "rgba(180, 180, 200, 1)",
hoverPaintStyle = {
strokeStyle: "#7ec3d9"
};
var connection1 = jsPlumb.connect({
source: "start",
target: "msgtype",
connector: "Bezier",
cssClass: "c1",
endpoint: "Blank",
endpointClass: "c1Endpoint",
anchors: ["BottomCenter", [0.75, 0, 0, -1]],
paintStyle: {
lineWidth: 6,
strokeStyle: "#a7b04b",
outlineWidth: 1,
outlineColor: "#666"
},
endpointStyle: {
fillStyle: "#a7b04b"
},
hoverPaintStyle: hoverPaintStyle
});

// make all .window divs draggable
jsPlumb.draggable(jsPlumb.getSelector(".window"));

}
};
})();

jsPlumb.bind("ready", function () {

jsPlumb.init();

// chrome fix.
document.onselectstart = function () {
return false;
};

// render mode
var resetRenderMode = function (desiredMode) {
var newMode = jsPlumb.setRenderMode(desiredMode);
$(".rmode").removeClass("selected");
$(".rmode[mode='" + newMode + "']").addClass("selected");

$(".rmode[mode='canvas']").attr("disabled", !jsPlumb.isCanvasAvailable());
$(".rmode[mode='svg']").attr("disabled", !jsPlumb.isSVGAvailable());
$(".rmode[mode='vml']").attr("disabled", !jsPlumb.isVMLAvailable());

//var disableList = (newMode === jsPlumb.VML) ? ",.rmode[mode='svg']" : ".rmode[mode='vml']";
// $(disableList).attr("disabled", true);
jsPlumbDemo.init();
};

$(".rmode").bind("click", function () {
var desiredMode = $(this).attr("mode");
if (jsPlumbDemo.reset) jsPlumbDemo.reset();
jsPlumb.reset();
resetRenderMode(desiredMode);
});

// explanation div is draggable
$("#explanation,.renderMode").draggable();

resetRenderMode(jsPlumb.SVG);

});

关于javascript - jsPlumb 的流程图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14725834/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com