使用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 ...
随机推荐
- 使用VS2012调试Dump文件
前一节我讲了怎么设置C++崩溃时生成Dump文件 , 点击 传送门 , 这一节我讲讲怎么使用 VS2012 调试生成的 Dump 文件 , 甚至可以精确到出错的那一行代码上面 ; 1. 生成 Dump ...
- Docker集群管理Swarm数据持久化
一.前言 和docker容器一样,Swarm集群中运行的服务也能够做数据持久化.我们可以通过volume.bind和nfs等方式来实现swarm集群应用数据的持久化.其实和docker数据持久化的形式 ...
- nltk30_Investigating bias with NLTK
sklearn实战-乳腺癌细胞数据挖掘(博客主亲自录制视频教程) https://study.163.com/course/introduction.htm?courseId=1005269003&a ...
- Hadoop基础-MapReduce的工作原理第一弹
Hadoop基础-MapReduce的工作原理第一弹 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 在本篇博客中,我们将深入学习Hadoop中的MapReduce工作机制,这些知识 ...
- nc命令的常用参数介绍
nc命令的常用参数介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 想必做运维的应该在网络安全上都对一些开源软件都应该是相当的了解吧,比如tcpdump,namp等神奇,今天要给 ...
- Java基础-面向对象第一特性之封装(Encapsulation)
Java基础-面向对象第一特性之封装(Encapsulation) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.理解什么是面向过程和面向对象 面向过程与面向对象都是我们编程中 ...
- 关于JSON的解析方式
借鉴:站在巨人的肩膀上 一.json-lib json-lib最开始的也是应用最广泛的json解析工具,json-lib 不好的地方确实是依赖于很多第三方包,在Json.org网站上,Java可以使用 ...
- 解决body设置height:100%无效问题
1. 解决html设置height:100%无效问题 通常我们需要让自己的网页内容能够更好的适配各种屏幕大小,会采用height:100%,但是我们发现问题出来了,height:100%无效,其实解决 ...
- Django中url()
使用django的时候,如果我们希望我们编写的view可以被正常访问,就需要配置url. 在django的官方文档中,url()的例子如下: polls/urls.py from django.con ...
- Java并发编程原理与实战四十二:锁与volatile的内存语义
锁与volatile的内存语义 1.锁的内存语义 2.volatile内存语义 3.synchronized内存语义 4.Lock与synchronized的区别 5.ReentrantLock源码实 ...