1.JointJs Paper_html/css_WEB-ITnose
关于JointJs的介绍,有一篇比较好 JointJS介绍
第一个类Paper joint.dia.Paper
属性
-
el css选择器,Paper将在该Css选择的Container下画SVG图.例如:el=’#paper’,则在
-
width paper的宽度
-
height paper的高度
-
origin paper原点的坐标,默认{x:0,y:0}
-
gridSzie 默认为1
-
model joint.dia.Graph object,根据MVC,该属性对应model,paper对应view
-
perpendicularLinks 连接线是否正交,默认为false
-
elementView 负责渲染graph ,默认 joint.dia.ElementView
-
linkView 负责渲染links,默认 joint.dia.LinkView
-
defaultLink 用户动态创建的link(比如:从一个port drag 一条线),默认为 joint.dia.Link,也可以是一个返回值类型为 joint.dia.Link函数 function(cellView, magnet) {}
-
interactive 如果设置为false,则graph中的element和link将禁止操作
-
validateMagnet(cellView, magnet) magnet翻译成中文就是磁石,在JointJs中它代表的是一个DOM元素,当用户点击magnet时,这个函数判断是否创建Link
-
validateConnection(cellViewS, magnetS, cellViewT, magnetT, end, linkView)在source view/magnet (cellViewS/magnetS) and target view/magnet (cellViewT/magnetT)之间是否允许链接。
-
linkConnectionPoint(linkView, view, magnet, reference)
这个函数允许用户指定link在渲染时stick到元素的某个坐标。这个函数返回一个点{x,y}。当然jointJS也给我们提供了一个强大的函数shapePerimeterConnectionPoint
shapePerimeterConnectionPoint joint.util.shapePerimeterConnectionPoint(linkView, view, magnet, ref)使用方式如下:
var paper = new joint.dia.Paper({ ... linkConnectionPoint: joint.util.shapePerimeterConnectionPoint ...})
效果如下:
-
snapLinks 当为true时,Link会寻找离它最近的元素进行闭合
-
linkPinning 当为true时,link可以终止于paper,也就是说link可以连接于一个点,而不是element
-
markAvailable 当用户点击magnet时,界面上显示可以连接的magnet。为了突出可以连接的magnet,添加必要的css
/* port styling */.available-magnet { fill: yellow;}/* element styling */.available-cell rect { stroke-dasharray: 5, 2;}
Copy after login -
async
-
embeddingMode 当为true时,paper改变为embed模式,具体说:用户可以将一个元素拖拽到另一个元素里面。在该模式下,所有的link和element会多一个z属性,就行css中的阴影有一个z属性表示层级。为了控制哪些元素可以embed,需要配置 validateEmbedding()。总之这个属性对于层级图是必须的。
-
validateEmbedding(childView, parentView) 如果childView允许被潜入到parentView,返回true.默认所有元素都可以embed到其他元素中
-
restrictTranslate/function(elementView) 当设置为true的时候,用户将不能将elemnt移动到paper边界之外。默认为false。当然它最大的好处不是这个,当给该属性配置一个函数时,你可以限制子元素不可以拖拽出父元素,比如:
restrictTranslate: function(elementView) { var parentId = elementView.model.get('parent'); return parentId && this.model.getCell(parentId).getBBox();}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

The article discusses the differences between HTML tags , , , and , focusing on their semantic vs. presentational uses and their impact on SEO and accessibility.
