mxgraphAPI
mxStencil
mxStencil:基于XML实现一个generic shape。
shape
- name
- w
- h
- aspect
variable/fixed
- strokewidth
connections > constraint
在connection下使用constraint来指定连接点
- perimeter 0/1 0手动指定连接点位置;1 根据图形自动推算
- x
- y
- name 唯一标识
background
background 只能包括以下元素:
- path
- rect
- roundrect
- ellipse
foreground
styling
drawing
path: is similar to Canvas
- move: 定义线条开始坐标
- line: 定义线条结束坐标
- quad: 二次贝塞尔曲线 控制点(x1, x2)
- curve: 三次贝塞尔曲线 控制点(x1, y1) (x2, y2)
- arc: 绘制圆 和canvas的arc不同,而是SVG的Arc
从当前点绘制一段椭圆弧到点(x, y)
- rx/ry: 椭圆的两个半轴的长度
- x-axis-raotation: 椭圆相对于坐标系的旋转角度,角度而非弧度
- larget-arc-flag: 标记绘制大弧(1)还是小弧(0)部分
- sweep-flag: 标记顺时针1还是逆时针0方向绘制
- x/y: 圆弧终点的坐标
- close 创建当前点回到起始点的路径
complex drawing
- rect
- roundrect
- ellipse 椭圆
image
- src
- x,y 图片位置
- w,h 图片宽高
- flipH optional 0/1 default:0
- flipV 沿着水平垂直轴翻转
text
- str 文字内容
- x,y 文字位置
- align 水平对齐方式 left/center/right
- valign 水平对齐方式 top/middle/bottom
- localized 0/1
- vertical 0/1 1 旋转90°渲染 default:0
- rotation 0-360 旋转文字
- align-shape 0/1 0设置文字旋转的时候忽略图形的旋转 default:1