-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathindex.js
More file actions
101 lines (89 loc) · 2.18 KB
/
index.js
File metadata and controls
101 lines (89 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import {jmArc} from "./src/shapes/jmArc.js";
import {jmArrow} from "./src/shapes/jmArrow.js";
import {jmBezier} from "./src/shapes/jmBezier.js";
import {jmCircle} from "./src/shapes/jmCircle.js";
import {jmHArc} from "./src/shapes/jmHArc.js";
import {jmLine} from "./src/shapes/jmLine.js";
import {jmPrismatic} from "./src/shapes/jmPrismatic.js";
import {jmRect} from "./src/shapes/jmRect.js";
import {jmArrowLine} from "./src/shapes/jmArrowLine.js";
import {jmImage} from "./src/shapes/jmImage.js";
import {jmLabel} from "./src/shapes/jmLabel.js";
import {jmResize} from "./src/shapes/jmResize.js";
import {jmEllipse} from "./src/shapes/jmEllipse.js";
import {jmPolygon} from "./src/shapes/jmPolygon.js";
import {jmStar} from "./src/shapes/jmStar.js";
import { jmGraph as jmGraphCore,
jmUtils,
jmList,
jmProperty,
jmShadow,
jmGradient,
jmFilter,
jmEvents,
jmControl,
jmPath } from "./src/core/jmGraph.js";
const shapes = {
"arc": jmArc,
"arrow": jmArrow,
"bezier": jmBezier,
"circle": jmCircle,
"harc": jmHArc,
"line": jmLine,
"prismatic": jmPrismatic,
"rect": jmRect,
"arrowline": jmArrowLine,
"image": jmImage,
"img": jmImage,
"label": jmLabel,
"resize": jmResize,
"ellipse": jmEllipse,
"polygon": jmPolygon,
"star": jmStar
}
class jmGraphImpl extends jmGraphCore {
constructor(canvas, option, callback) {
// 合并shapes
option = Object.assign({}, option);
option.shapes = Object.assign(shapes, option.shapes||{});
if(typeof option == 'function') {
callback = option;
option = {};
}
super(canvas, option, callback);
}
static create(...args) {
return new jmGraphImpl(...args);
}
}
//创建实例,支持不加 new 直接调用
const createJmGraph = (...args) => {
return new jmGraphImpl(...args);
}
export default jmGraphImpl;
export {
jmUtils,
jmList,
jmControl,
jmPath,
jmShadow,
jmGradient,
jmFilter,
jmArc,
jmArrow,
jmBezier,
jmCircle,
jmHArc,
jmLine,
jmPrismatic,
jmRect,
jmArrowLine,
jmImage,
jmLabel,
jmResize,
jmEllipse,
jmPolygon,
jmStar,
jmGraphImpl as jmGraph,
createJmGraph as create
};