jmgraph 3.2.16 → 3.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +251 -428
- package/build/gulpfile.js +142 -142
- package/build/package-lock.json +10666 -0
- package/build/package.json +71 -71
- package/dev.js +9 -9
- package/dist/jmgraph.core.min.js +1 -1
- package/dist/jmgraph.core.min.js.map +1 -1
- package/dist/jmgraph.js +3500 -2668
- package/dist/jmgraph.min.js +1 -1
- package/example/ball.html +216 -216
- package/example/base.html +111 -111
- package/example/canvas.html +53 -53
- package/example/cell.html +283 -283
- package/example/controls/arc.html +128 -128
- package/example/controls/arrowline.html +77 -77
- package/example/controls/bezier.html +298 -298
- package/example/controls/img.html +96 -96
- package/example/controls/label.html +86 -86
- package/example/controls/line.html +172 -172
- package/example/controls/prismatic.html +62 -62
- package/example/controls/rect.html +63 -63
- package/example/controls/resize.html +111 -111
- package/example/controls/test.html +359 -359
- package/example/es.html +69 -69
- package/example/es5module.html +62 -63
- package/example/heartarc.html +115 -115
- package/example/index.html +46 -46
- package/example/js/require.js +4 -4
- package/example/love/img/bling/bling.tps +265 -265
- package/example/love/img/bling.json +87 -87
- package/example/love/img/bling.tps +295 -295
- package/example/love/img/love.json +95 -95
- package/example/love/img/love.tps +315 -315
- package/example/love/img/qq/qq.tps +399 -399
- package/example/love/img/qq.json +242 -242
- package/example/love/index.html +40 -40
- package/example/love/js/game.js +558 -558
- package/example/music.html +210 -210
- package/example/node/test.js +137 -137
- package/example/pdf.html +186 -186
- package/example/progress.html +172 -172
- package/example/pso.html +147 -147
- package/example/sort.html +804 -815
- package/example/tweenjs.html +83 -83
- package/example/webgl.html +278 -278
- package/example/xfj/index.html +331 -331
- package/example/xfj/shake.js +48 -48
- package/example/xfj/testori.html +75 -75
- package/index.js +99 -99
- package/package.json +58 -56
- package/src/core/jmControl.js +1376 -1531
- package/src/core/jmEvents.js +240 -281
- package/src/core/jmGradient.js +231 -231
- package/src/core/jmGraph.js +569 -569
- package/src/core/jmList.js +92 -157
- package/src/core/jmObject.js +83 -103
- package/src/core/jmPath.js +35 -35
- package/src/core/jmProperty.js +71 -110
- package/src/core/jmShadow.js +65 -65
- package/src/core/jmUtils.js +906 -919
- package/src/lib/earcut.js +680 -680
- package/src/lib/earcut.md +73 -73
- package/src/lib/webgl/base.js +522 -452
- package/src/lib/webgl/core/buffer.js +48 -48
- package/src/lib/webgl/core/mapSize.js +40 -40
- package/src/lib/webgl/core/mapType.js +43 -43
- package/src/lib/webgl/core/program.js +138 -138
- package/src/lib/webgl/core/shader.js +13 -13
- package/src/lib/webgl/core/texture.js +60 -60
- package/src/lib/webgl/gradient.js +168 -168
- package/src/lib/webgl/index.js +137 -11
- package/src/lib/webgl/path.js +568 -561
- package/src/shapes/jmArrowLine.js +36 -36
- package/src/shapes/jmImage.js +244 -244
- package/src/shapes/jmLabel.js +271 -271
- package/src/shapes/jmResize.js +332 -330
package/src/core/jmProperty.js
CHANGED
|
@@ -1,110 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
import {jmUtils} from "./jmUtils.js";
|
|
3
|
-
import { jmObject } from "./jmObject.js";
|
|
4
|
-
|
|
5
|
-
const PROPERTY_KEY = Symbol("properties");
|
|
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
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
set graph(v) {
|
|
73
|
-
return this.property('graph', v);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* 绘制模式 2d/webgl
|
|
78
|
-
* @property mode
|
|
79
|
-
* @type {string}
|
|
80
|
-
*/
|
|
81
|
-
get mode() {
|
|
82
|
-
let m = this.property('mode');
|
|
83
|
-
if(m) return m;
|
|
84
|
-
else if(this.is('jmGraph')) return this.property('mode');
|
|
85
|
-
return this.graph.mode;
|
|
86
|
-
}
|
|
87
|
-
set mode(v) {
|
|
88
|
-
return this.property('mode', v);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* 在下次进行重绘时执行
|
|
93
|
-
* @param {Function} handler
|
|
94
|
-
*/
|
|
95
|
-
requestAnimationFrame(handler) {
|
|
96
|
-
return jmUtils.requestAnimationFrame(handler, this.graph? this.graph.canvas: null);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* 清除执行回调
|
|
100
|
-
* @param {Function} handler
|
|
101
|
-
* @returns
|
|
102
|
-
*/
|
|
103
|
-
cancelAnimationFrame(handler) {
|
|
104
|
-
return jmUtils.cancelAnimationFrame(handler, this.graph? this.graph.canvas: null);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export { jmProperty };
|
|
109
|
-
|
|
110
|
-
|
|
1
|
+
|
|
2
|
+
import {jmUtils} from "./jmUtils.js";
|
|
3
|
+
import { jmObject } from "./jmObject.js";
|
|
4
|
+
|
|
5
|
+
const PROPERTY_KEY = Symbol("properties");
|
|
6
|
+
|
|
7
|
+
export default class jmProperty extends jmObject {
|
|
8
|
+
constructor(params) {
|
|
9
|
+
super();
|
|
10
|
+
this[PROPERTY_KEY] = {};
|
|
11
|
+
if(params && params.mode) this.mode = params.mode;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
property(...pars) {
|
|
15
|
+
if(pars) {
|
|
16
|
+
const pros = this[PROPERTY_KEY];
|
|
17
|
+
const name = pars[0];
|
|
18
|
+
if(pars.length > 1) {
|
|
19
|
+
const value = pars[1];
|
|
20
|
+
const args = {oldValue: pros[name], newValue: value};
|
|
21
|
+
pros[name] = pars[1];
|
|
22
|
+
if(this.emit) this.emit('propertyChange', name, args);
|
|
23
|
+
return pars[1];
|
|
24
|
+
}
|
|
25
|
+
else if(name) {
|
|
26
|
+
return pros[name];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get needUpdate() {
|
|
32
|
+
return this.property('needUpdate');
|
|
33
|
+
}
|
|
34
|
+
set needUpdate(v) {
|
|
35
|
+
this.property('needUpdate', v);
|
|
36
|
+
if(v && !this.is('jmGraph') && this.graph) {
|
|
37
|
+
this.graph.needUpdate = true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get graph() {
|
|
42
|
+
let g = this.property('graph');
|
|
43
|
+
g = g || (this.property('graph', this.findParent('jmGraph')));
|
|
44
|
+
return g;
|
|
45
|
+
}
|
|
46
|
+
set graph(v) {
|
|
47
|
+
return this.property('graph', v);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get mode() {
|
|
51
|
+
let m = this.property('mode');
|
|
52
|
+
if(m) return m;
|
|
53
|
+
else if(this.is('jmGraph')) return this.property('mode');
|
|
54
|
+
return this.graph.mode;
|
|
55
|
+
}
|
|
56
|
+
set mode(v) {
|
|
57
|
+
return this.property('mode', v);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
requestAnimationFrame(handler) {
|
|
61
|
+
return jmUtils.requestAnimationFrame(handler, this.graph? this.graph.canvas: null);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
cancelAnimationFrame(handler) {
|
|
65
|
+
return jmUtils.cancelAnimationFrame(handler, this.graph? this.graph.canvas: null);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { jmProperty };
|
|
70
|
+
|
|
71
|
+
|
package/src/core/jmShadow.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import {jmUtils} from "./jmUtils.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 画图阴影对象表示法
|
|
5
|
-
*
|
|
6
|
-
* @class jmShadow
|
|
7
|
-
* @param {number} x 横坐标偏移量
|
|
8
|
-
* @param {number} y 纵坐标编移量
|
|
9
|
-
* @param {number} blur 模糊值
|
|
10
|
-
* @param {string} color 阴影的颜色
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export default class jmShadow {
|
|
14
|
-
constructor(x, y, blur, color) {
|
|
15
|
-
if(typeof x == 'string' && !y && !blur && !color) {
|
|
16
|
-
this.fromString(x);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
this.x = x;
|
|
20
|
-
this.y = y;
|
|
21
|
-
this.blur = blur;
|
|
22
|
-
this.color = color;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* 根据字符串格式转为阴影
|
|
27
|
-
* @method fromString
|
|
28
|
-
* @param {string} s 阴影字符串 x,y,blur,color
|
|
29
|
-
*/
|
|
30
|
-
fromString(s) {
|
|
31
|
-
if(!s) return;
|
|
32
|
-
let ms = s.match(/\s*([^,]+)\s*,\s*([^,]+)\s*(,[^,]+)?\s*(,[\s\S]+)?\s*/i);
|
|
33
|
-
if(ms) {
|
|
34
|
-
this.x = ms[1]||0;
|
|
35
|
-
this.y = ms[2]||0;
|
|
36
|
-
if(ms[3]) {
|
|
37
|
-
ms[3] = jmUtils.trim(ms[3],', ');
|
|
38
|
-
//如果第三位是颜色格式,则表示为颜色
|
|
39
|
-
if(ms[3].indexOf('#')===0 || /^rgb/i.test(ms[3])) {
|
|
40
|
-
this.color = ms[3];
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
this.blur = jmUtils.trim(ms[3],', ');
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if(ms[4]) {
|
|
47
|
-
this.color = jmUtils.trim(ms[4],', ');
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 转为字符串格式 x,y,blur,color
|
|
55
|
-
* @method toString
|
|
56
|
-
* @returns {string} 阴影字符串
|
|
57
|
-
*/
|
|
58
|
-
toString() {
|
|
59
|
-
let s = this.x + ',' + this.y;
|
|
60
|
-
if(this.blur) s += ',' + this.blur;
|
|
61
|
-
if(this.color) s += ',' + this.color;
|
|
62
|
-
return s;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
1
|
+
import {jmUtils} from "./jmUtils.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 画图阴影对象表示法
|
|
5
|
+
*
|
|
6
|
+
* @class jmShadow
|
|
7
|
+
* @param {number} x 横坐标偏移量
|
|
8
|
+
* @param {number} y 纵坐标编移量
|
|
9
|
+
* @param {number} blur 模糊值
|
|
10
|
+
* @param {string} color 阴影的颜色
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default class jmShadow {
|
|
14
|
+
constructor(x, y, blur, color) {
|
|
15
|
+
if(typeof x == 'string' && !y && !blur && !color) {
|
|
16
|
+
this.fromString(x);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
this.x = x;
|
|
20
|
+
this.y = y;
|
|
21
|
+
this.blur = blur;
|
|
22
|
+
this.color = color;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 根据字符串格式转为阴影
|
|
27
|
+
* @method fromString
|
|
28
|
+
* @param {string} s 阴影字符串 x,y,blur,color
|
|
29
|
+
*/
|
|
30
|
+
fromString(s) {
|
|
31
|
+
if(!s) return;
|
|
32
|
+
let ms = s.match(/\s*([^,]+)\s*,\s*([^,]+)\s*(,[^,]+)?\s*(,[\s\S]+)?\s*/i);
|
|
33
|
+
if(ms) {
|
|
34
|
+
this.x = ms[1]||0;
|
|
35
|
+
this.y = ms[2]||0;
|
|
36
|
+
if(ms[3]) {
|
|
37
|
+
ms[3] = jmUtils.trim(ms[3],', ');
|
|
38
|
+
//如果第三位是颜色格式,则表示为颜色
|
|
39
|
+
if(ms[3].indexOf('#')===0 || /^rgb/i.test(ms[3])) {
|
|
40
|
+
this.color = ms[3];
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this.blur = jmUtils.trim(ms[3],', ');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if(ms[4]) {
|
|
47
|
+
this.color = jmUtils.trim(ms[4],', ');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 转为字符串格式 x,y,blur,color
|
|
55
|
+
* @method toString
|
|
56
|
+
* @returns {string} 阴影字符串
|
|
57
|
+
*/
|
|
58
|
+
toString() {
|
|
59
|
+
let s = this.x + ',' + this.y;
|
|
60
|
+
if(this.blur) s += ',' + this.blur;
|
|
61
|
+
if(this.color) s += ',' + this.color;
|
|
62
|
+
return s;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
66
|
export { jmShadow };
|