介绍

使用svg完成画图,四个概念:

anchor: endpoint在的位置,可通过name访问

endpoint:connection的一端节点,通过addPoint makeSource, connect创建,

connector:连接线

overlay:connector的装饰组件,如labelarrow

一个connection由一个connector,两个endpoint,0或者多个overlay构成,每个endpoint有一个关联的anchor.

anchor有四种类型:

static:固定不可移动的点

dynamic:从一组staticanchor中,每次动态选取一个合适的

perimeter:沿着特定图形的边

continous:没有固定的位置,根据线另一端点的朝向决定

connectors四种类型

Bezier(default):弯曲的贝塞尔曲线,参数是curviness用来定义控制点,默认150

Straight:stub和gap(线和endpoint的间隔)

flowchart: 折线,有stubalwaysRespectStubs gap midpoint(转折点)和cornerRadius

statemachine:轻微弯曲的线,quadraticBezier(二次贝塞尔曲线),有margin,curviness, proximityLimit(连接到自己时最小距离)

endpoint有四种类型

dot:radius cssClass  hoverClass

rectangle:width height cssClas hoverClass

blank:不可见,对于可拖拽链接的,使用dot和rectangle参数,并在css中设为透明。

image:从url得到image,src cssClass hoverClass

overlay有五种类型

arrow:控制长宽等

label:

plainArrow:三角形箭头

diamond:菱形

custom:任意的dom元素,需要实现create方法

location:

[0..1]代表connector上的比例

大于1或小于0代表绝对值的pixel

connections:

adding:在connectmakeSource  addEndpoint中

show和hideoverlay:connection.hideOverlay,connection.showOverlay  ,endPoint有同样的方法

removeoverlay:connection.removeOverlay()

重用commonsetting

var common = {
anchors:[ "BottomCenter", "TopCenter" ],
endpoints:["Dot", "Blank" ]
}; jsPlumb.connect({ source:"someElement", target:"someOtherElement" }, common); jsPlumb.connect({ source:"aThirdElement", target:"yetAnotherElement" }, common);

画连线

设置endPoint为 source
var exampleGreyEndpointOptions = {
endpoint:"Rectangle",
paintStyle:{ width:25, height:21, fillStyle:'#666' },
isSource:true,
connectorStyle : { strokeStyle:"#666" },
isTarget:true
};
var endpoint = jsPlumb.addEndpoint('elementId', exampleGreyEndpointOptions
);

makeTarget和makeSource

将整个element变成target或source

jsPlumb.makeSource("el1", {
anchor:"Continuous",
endpoint:["Rectangle", { width:40, height:20 }],
maxConnections:3
});

uniqueEndpoint:

设置只有一个 endPoint

移除connections和endpoint

jsPlumb.detach(conn);
删除el上所有链接:jsPlumb.detachAllConnections(el, [params])
所有链接:jsPlumb.detachEveryConnection();

通过connect中的parameters参数向jsPlumb中传入参数。

动画:

jsPlumb.animate : function(el, properties, options) 调用方式类似于 jQuery

查询jsPlumb

可以用来查找connection或者endpoint等

css样式

overlays: cssClass

paintStyle可设置:fillStyle strokeStyle  lineWidth outlineWidth  outlineColordashStyle

hoverpaint style

hoverPaintStyle endpointHoverStyles

[转]http://blog.csdn.net/dananhai381/article/details/38870615

jsPlumb 学习笔记的更多相关文章

  1. jsPlumb学习笔记

    这就是一个给元素画连接线的工具. <!DOCTYPE html> <html> <head> <title>jsPlumb</title> ...

  2. 前端流程图jsplumb学习笔记

    1.这篇博客很好,另外两个是官网文档 http://www.cnblogs.com/leomYili/p/6346526.html https://jsplumbtoolkit.com/communi ...

  3. js学习笔记:webpack基础入门(一)

    之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...

  4. PHP-自定义模板-学习笔记

    1.  开始 这几天,看了李炎恢老师的<PHP第二季度视频>中的“章节7:创建TPL自定义模板”,做一个学习笔记,通过绘制架构图.UML类图和思维导图,来对加深理解. 2.  整体架构图 ...

  5. PHP-会员登录与注册例子解析-学习笔记

    1.开始 最近开始学习李炎恢老师的<PHP第二季度视频>中的“章节5:使用OOP注册会员”,做一个学习笔记,通过绘制基本页面流程和UML类图,来对加深理解. 2.基本页面流程 3.通过UM ...

  6. 2014年暑假c#学习笔记目录

    2014年暑假c#学习笔记 一.C#编程基础 1. c#编程基础之枚举 2. c#编程基础之函数可变参数 3. c#编程基础之字符串基础 4. c#编程基础之字符串函数 5.c#编程基础之ref.ou ...

  7. JAVA GUI编程学习笔记目录

    2014年暑假JAVA GUI编程学习笔记目录 1.JAVA之GUI编程概述 2.JAVA之GUI编程布局 3.JAVA之GUI编程Frame窗口 4.JAVA之GUI编程事件监听机制 5.JAVA之 ...

  8. seaJs学习笔记2 – seaJs组建库的使用

    原文地址:seaJs学习笔记2 – seaJs组建库的使用 我觉得学习新东西并不是会使用它就够了的,会使用仅仅代表你看懂了,理解了,二不代表你深入了,彻悟了它的精髓. 所以不断的学习将是源源不断. 最 ...

  9. CSS学习笔记

    CSS学习笔记 2016年12月15日整理 CSS基础 Chapter1 在console输入escape("宋体") ENTER 就会出现unicode编码 显示"%u ...

随机推荐

  1. WCF中DataContractAttribute 类

    一.这个类的作用 使用提供的数据协定,将类型实例序列化和反序列化为 XML 流或文档.无法继承此类,(DataContractSerializer 用于序列化和反序列化在 Windows Commun ...

  2. magnetom模板制作

    我个人认为Magento模板制作的难点在于不了解Magento的架构,不会调动block.Magento的block调动几乎都是靠xml.在下面的内容会提及如何操作. 制作Magento模板的前提是: ...

  3. Android Packaging Problem

    android Description Resource Path Location Type Error generating final archive: Debug Certificate ex ...

  4. js中this和回调方法循环-我们到底能走多远系列(35)

    我们到底能走多远系列(35) 扯淡: 13年最后一个月了,你们在13年初的计划实现了吗?还来得及吗? 请加油~ 主题: 最近一直在写js,遇到了几个问题,可能初入门的时候都会遇到吧,总结下. 例子: ...

  5. Binary Tree Traversal

    1.Preorder Traversal Given a binary tree, return the preorder traversal of its nodes' values. For ex ...

  6. Ubuntu系统的修改Hosts

    1.修改hostssudo gedit /etc/hosts2.添加解析记录( . )完整案例:127.0.0.1 localhost.localdomain localhost简洁记录:127.0. ...

  7. python 函数性能分析

    1 使用profile分析函数性能示例1, 以profile为例: import profile def profileTest(): Total =1; for i in range(10): To ...

  8. tyvj 1057 dp 变形背包

    P1057 金明的预算方案 时间: 1000ms / 空间: 131072KiB / Java类名: Main 背景 NOIP2006 提高组 第二道 描述 金明今天很开心,家里购置的新房就要领钥匙了 ...

  9. js部分---数组及练习题;

    数据存储--数组: 强类型语言数组 1.同一类型的数据存储的集合,在内存中是连续的 2.定义的时候需要制定长度 弱类型语言数组 1.可以存储任意类型的数据 2.在内存中不连续,不需要制定长度 定义一个 ...

  10. 第4章 yum在线安装

    1.概述 <1>rpm包的安装过程中,rpm包的依赖性太强 如果所有rpm包都是手工安装,则rpm包使用难度较大, 因而出现了yum在线安装的方法 <2>好处:将所有软件包放到 ...