【问题标题】:Set jsPlumb Line Pattern设置 jsPlumb 线型
【发布时间】:2016-06-22 06:07:33
【问题描述】:

我用 jsPlumb 做了一条线。

var jsPlumb_instance = jsPlumb.getInstance();   
var endpointOptions = { 
                anchor:'BottomCenter',
                maxConnections:1,                      
                endpoint:['Rectangle',{width:'0px', height:'0px' }], 
                paintStyle:{fillStyle:'black'},
                connectorStyle : {  lineWidth: '1px' , strokeStyle: 'black' },
                connector : ['Straight'],                   
                setDragAllowedWhenFull:true,                    


};  
div1Endpoint = jsPlumb_instance.addEndpoint(id1, endpointOptions);
div2Endpoint = jsPlumb_instance.addEndpoint(id2, endpointOptions);      

jsPlumb_instance.connect({  
    source:div1Endpoint,
    target:div2Endpoint,
}); 

我想通过调整线条的图案来自定义线条。我注意到这条线很结实,如下图所示:

我想使它成为虚线或虚线。可能吗?如果是,怎么做?

【问题讨论】:

    标签: javascript jquery jquery-ui jquery-plugins jsplumb


    【解决方案1】:

    您需要自定义paintStyle

    jsPlumb_instance.connect({  
        source:div1Endpoint,
        target:div2Endpoint,
        paintStyle:{ strokeStyle:"blue", lineWidth:10,dashstyle = '3 3' }
    }); 
    

    顺便说一下,paintStyle 有 3 种类型;用于源端点、目标端点和连接。

    您可以在这里查看; https://jsplumbtoolkit.com/community/doc/paint-styles.html

    这是一个例子; http://jsfiddle.net/mokarakaya/gcabyo3h/4/

    【讨论】:

    • 谢谢,但是 '3 3' 在您的 dashstyle 值中代表什么?我在文档链接中找不到它。
    • @Eliyyahu 我创建了一个示例。我希望它有所帮助; jsfiddle.net/mokarakaya/gcabyo3h/4
    • '3 3' 表示在连接线中,第 3 行的宽度后跟 3 的空白宽度,依此类推。
    猜你喜欢
    • 1970-01-01
    • 2013-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-16
    • 2022-01-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多