使用jsplumb的一些笔记
欢迎就是需要使用jsplumb跟正在使用jsplumb的一起讨论 欢迎私聊
1.关于jsplumb的connection的一些事件
####connection拖动的事件
instance.bind('connectionDragStop', function(conn) {});
####连接废弃
instance.bind('connectionAborted', (conn, originalEvent) => {})
####在落下来某一个点之前
instance.bind('beforeDrop', (conn) => {})
####
instance.bind('beforeDrag', (conn) => {})
####
instance.bind('connectionDrag', (conn) => {})
####
instance.bind('beforeDetach', (conn) => {})
####想要拿到连线的点击事件啊,hover事件啊,都可以通过bind来实现
instance.bind('click', function(c) {})
等等这些事件吧~~~~~
2.就是关于连接线的一些样式问题
1.你可以在一个页面上实现多种连接的样式,这个都是可以实现的
2.有关于线是实线啊,虚线啊这些也都是可以实现的 虚线的话dashstyle可以来实现,应该是跟css差不多的
恩。。。。。
放一些废弃代码
initConnect(instance) {
var that = this;
instance.batch(function() {
for (const point of that.$store.state.nodes) {
that.initNode(instance, point.node_id)
if (point.child_nodes.length > || point.parent_node == 'root') {
instance.addEndpoint(point.node_id, {
uuid: `${point.node_id}-bottom`,
anchor: 'Bottom',
maxConnections: -,
// connectorStyle: { stroke: '#2FB39C', strokeWidth: 2 },
// connectorHoverStyle: {
// strokeWidth: 3,
// stroke: "yellow",
// },
deleteEndpointsOnEmpty: true,
dragOptions: {},
}, {
isSource: true,
isTarget: true,
});
}
if (point.parent_node !== 'root') {
instance.addEndpoint(point.node_id, {
uuid: `${point.node_id}-top`,
anchor: 'Top',
maxConnections: -,
deleteEndpointsOnEmpty: true,
}, {
isSource: true,
isTarget: true,
});
}
if (point.jump_nodes.length > ) {
point.jump_nodes.forEach((item, index) => {
instance.connect({
source: point.node_id,
target: item,
paintStyle: {
stroke: "#E72F1F",
strokeWidth: 2.5,
dashstyle: "4 2",
},
maxConnections: -,
anchor: 'Right',
overlays: [
["Arrow",
{
width: ,
length: ,
location: ,
events: {
click: function() {
// alert('click')
}
}
}
],
["Custom", {
create: function(component) {
return $('<img src=' + shears + '>');
},
location: -,
events: {
click: function(e) {
that.deleteConfirmFun(instance, e.component)
},
}
}]
]
});
})
}
}
// init transition
for (const i of that.$store.state.lines) {
const uuid = [`${i[]}-bottom`, `${i[]}-top`];
instance.connect({
uuids: uuid,
});
}
})
var sourceEndpoint=this.jsPlumbInstance.getEndpoint(`A1-bottom`);
console.log('sourceEndpoint',sourceEndpoint)
},
addConnect(point) {
var parent=this.findParentNode(point.node_id);
// console.log('parentNode',parentNode)
this.jsPlumbInstance.addEndpoint(point.node_id, {
uuid: `${point.node_id}-bottom`,
anchor: 'Bottom',
maxConnections: -,
deleteEndpointsOnEmpty: true,
dragOptions: {},
}, {
isSource: true,
isTarget: true,
});
this.jsPlumbInstance.addEndpoint(point.node_id, {
uuid: `${point.node_id}-top`,
anchor: 'Top',
maxConnections: -,
deleteEndpointsOnEmpty: true,
}, {
isSource: true,
isTarget: true,
});
var sourceEndpoint=this.jsPlumbInstance.getEndpoint(`${parent.node_id}-bottom`);
var targetEndpoint=this.jsPlumbInstance.getEndpoint(`${point.node_id}-top`);
const uuid = [`${parent.node_id}-bottom`, `${point.node_id}-top`];
this.jsPlumbInstance.connect({
source:sourceEndpoint,
target:targetEndpoint
})
this.jsPlumbInstance.repaintEverything({clearEdits:false})
},
deleteEndpoint() {
console.log('')
// jsPlumb.detach(conn);
// 删除他与子元素的连接
console.log(this.jsPlumbInstance)
// this.jsPlumbInstance.remove(this.nodes[0].node_id);
// this.jsPlumbInstance.empty(this.nodes[0].node_id);
var a = this.jsPlumbInstance.getEndpoint(`${this.nodes[].node_id}-bottom`)
console.log('a', a)
this.jsPlumbInstance.deleteEndpoint(a)
},
恩。。。还有一个问题
就是如果你连线的元素发生了位置的转移,如果你是通过端点去连接的
然后我想说 是确实需要重绘的
如果你元素的位置发生了改变
有什么想说的 欢迎来指教
使用jsplumb的一些笔记的更多相关文章
- jsPlumb.jsAPI阅读笔记(官方文档翻译)
jsPlumb DOCS 公司要开始做流程控制器,所以先调研下jsPlumb,下文是阅读jsPlumb提供的document所产生的归纳总结 setup 如果不使用jQuery或者类jQuery库,则 ...
- [转]jsPlumb插件做一个模仿viso的可拖拉流程图
原贴:https://www.cnblogs.com/sggx/p/3836432.html 前言 这是我第一次写博客,心情还是有点小小的激动!这次主要分享的是用jsPlumb,做一个可以给用户自定义 ...
- jsPlumb 学习笔记
介绍 使用svg完成画图,四个概念: anchor: endpoint在的位置,可通过name访问 endpoint:connection的一端节点,通过addPoint makeSource, co ...
- 前端流程图jsplumb学习笔记
1.这篇博客很好,另外两个是官网文档 http://www.cnblogs.com/leomYili/p/6346526.html https://jsplumbtoolkit.com/communi ...
- jsPlumb学习笔记
这就是一个给元素画连接线的工具. <!DOCTYPE html> <html> <head> <title>jsPlumb</title> ...
- jsplumb实现流程图
流程图使用工具汇总 jsPlumb,开源软件,推荐使用,参考学习链接: jsplumb学习笔记.基本概念.中文简易教程 jTopo myflow Go.js JointJS,属于商业软件 mxGrap ...
- git-简单流程(学习笔记)
这是阅读廖雪峰的官方网站的笔记,用于自己以后回看 1.进入项目文件夹 初始化一个Git仓库,使用git init命令. 添加文件到Git仓库,分两步: 第一步,使用命令git add <file ...
- js学习笔记:webpack基础入门(一)
之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...
- SQL Server技术内幕笔记合集
SQL Server技术内幕笔记合集 发这一篇文章主要是方便大家找到我的笔记入口,方便大家o(∩_∩)o Microsoft SQL Server 6.5 技术内幕 笔记http://www.cnbl ...
随机推荐
- HTTP状态码的含义: 200:400:403:404:408:500:503:504
http协议的状态码 1xx(临时响应) 表示临时响应并需要请求者继续执行操作的状态码. 100(继续) 请求者应当继续提出请求.服务器返回此代码表示已收到请求的第一部分,正在等待其余部分. 101( ...
- C++ explicit constructor/copy constructor note
C++:explict 作用显示声明构造函数只能被显示调用从而阻止编译器的隐式转换,类似只能用()显示调用,而不能=或者隐式调用 #include <iostream> #include ...
- R语言缺失值高级处理方法
0 引言 对于一些数据集,不可避免的出现缺失值.对缺失值的处理非常重要,它是我们能否继续进行数据分析的关键,也是能否继续大数据分析的数据基础. 1 缺失值分类 在对缺失数据进行处理前,了解数据缺失的机 ...
- php获取星期几周几
PHP星期几获取代码: date("l"); //data就可以获取英文的星期比如Sundaydate("w"); //这个可以获取数字星期比如123,注意0是 ...
- tp 用group去重
$baseGoodIds_arr = [1,2,3,4,5,6,7,8,9];$relate_gimgs = D('GoodsImages')->where(['good_id' => [ ...
- 并发库应用之二 & Java原子性操作类应用
Java5的线程并发库中,提供了一组atomic class来帮助我们简化同步处理.基本工作原理是使用了同步synchronized的方法实现了对一个long, integer, 对象的增.减.赋值( ...
- Struts2 01---环境搭配
开发工具:Eclipse Struts版本:2.3.24 最近在学SSH框架,SSH是 struts+spring+hibernate的一个集成框架,是目前比较流行的一种Web应用程序开源框架. ...
- Android SDK更新失败对策
Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml Failed to fetch URL https:// ...
- Web Uploader
Github上的例子没看太明白,在网上找了些资料自己写了个demo,基本上就是用create方法初始化,然后on一堆事件,上传的进度条用的是swf格式的动画,感觉不是很先进的样子.不过我暂时也没搞明白 ...
- 在Linode VPS上搭建离线下载神器Aria2+WEBUI管理及对国内云盘看法
在Linode VPS上搭建离线下载神器Aria2+WEBUI管理及对国内云盘看法 2015-09-21 by Hansen 原文链接:http://www.hansendong.me/archive ...