jmgraph 3.2.4 → 3.2.5
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/dist/jmgraph.core.min.js +1 -1
- package/dist/jmgraph.core.min.js.map +1 -1
- package/dist/jmgraph.js +7 -9
- package/dist/jmgraph.min.js +1 -1
- package/package.json +56 -55
- package/src/core/jmEvents.js +2 -2
- package/src/core/jmGraph.js +1 -1
- package/src/shapes/jmImage.js +2 -2
- package/src/shapes/jmLabel.js +2 -2
package/package.json
CHANGED
|
@@ -1,55 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"family": "jmgraph",
|
|
3
|
-
"name": "jmgraph",
|
|
4
|
-
"version": "3.2.
|
|
5
|
-
"description": "一个简单的canvas画图库",
|
|
6
|
-
"homepage": "http://graph.jm47.com/",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"canvas",
|
|
9
|
-
"html5",
|
|
10
|
-
"webgl"
|
|
11
|
-
],
|
|
12
|
-
"author": "jiamao<haofefe@163.com>",
|
|
13
|
-
"engines": {},
|
|
14
|
-
"dependencies": {},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@commitlint/cli": "^7.6.1",
|
|
17
|
-
"@commitlint/config-conventional": "^7.6.0",
|
|
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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"family": "jmgraph",
|
|
3
|
+
"name": "jmgraph",
|
|
4
|
+
"version": "3.2.5",
|
|
5
|
+
"description": "一个简单的canvas画图库",
|
|
6
|
+
"homepage": "http://graph.jm47.com/",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"canvas",
|
|
9
|
+
"html5",
|
|
10
|
+
"webgl"
|
|
11
|
+
],
|
|
12
|
+
"author": "jiamao<haofefe@163.com>",
|
|
13
|
+
"engines": {},
|
|
14
|
+
"dependencies": {},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@commitlint/cli": "^7.6.1",
|
|
17
|
+
"@commitlint/config-conventional": "^7.6.0",
|
|
18
|
+
"canvas": "^2.11.2",
|
|
19
|
+
"cz-conventional-changelog": "^2.1.0",
|
|
20
|
+
"express": "^4.17.1"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/jiamao/jmgraph.git"
|
|
25
|
+
},
|
|
26
|
+
"main": "./index.js",
|
|
27
|
+
"spm": {
|
|
28
|
+
"alias": {},
|
|
29
|
+
"output": [
|
|
30
|
+
"main.js"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"licenses": [
|
|
34
|
+
{
|
|
35
|
+
"type": "MIT",
|
|
36
|
+
"url": "https://github.com/jiamao/jmgraph/blob/master/LICENSE"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/jiamao/jmgraph/issues"
|
|
41
|
+
},
|
|
42
|
+
"directories": {
|
|
43
|
+
"example": "example"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "cd build & npm i & gulp & cd ..",
|
|
47
|
+
"push": "npm publish --registry=https://registry.npmjs.org",
|
|
48
|
+
"dev": "node dev"
|
|
49
|
+
},
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"config": {
|
|
52
|
+
"commitizen": {
|
|
53
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
package/src/core/jmEvents.js
CHANGED
|
@@ -83,7 +83,7 @@ class jmMouseEvent {
|
|
|
83
83
|
|
|
84
84
|
init(instance, container, target) {
|
|
85
85
|
let canvas = this.target;
|
|
86
|
-
let doc = typeof
|
|
86
|
+
let doc = typeof document != 'undefined'? document: null;
|
|
87
87
|
//禁用鼠标右健系统菜单
|
|
88
88
|
//canvas.oncontextmenu = function() {
|
|
89
89
|
// return false;
|
|
@@ -208,7 +208,7 @@ class jmKeyEvent {
|
|
|
208
208
|
* 初始化健盘事件
|
|
209
209
|
*/
|
|
210
210
|
init(container, target) {
|
|
211
|
-
let doc = typeof
|
|
211
|
+
let doc = typeof document != 'undefined'? document: null;
|
|
212
212
|
/**
|
|
213
213
|
* 检查是否触发健盘事件至画布
|
|
214
214
|
* 如果触发对象为输入框等对象则不响应事件
|
package/src/core/jmGraph.js
CHANGED
|
@@ -60,7 +60,7 @@ export default class jmGraph extends jmControl {
|
|
|
60
60
|
canvas = canvas[0];
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
if(canvas.
|
|
63
|
+
if(!canvas.getContext && typeof document != 'undefined') {
|
|
64
64
|
this.container = canvas;
|
|
65
65
|
let cn = document.createElement('canvas');
|
|
66
66
|
canvas.appendChild(cn);
|
package/src/shapes/jmImage.js
CHANGED
|
@@ -193,7 +193,7 @@ export default class jmImage extends jmControl {
|
|
|
193
193
|
* @return {img} 图片对象
|
|
194
194
|
*/
|
|
195
195
|
getImage() {
|
|
196
|
-
|
|
196
|
+
const src = this.image || this.style.src || this.style.image;
|
|
197
197
|
if(this.__img && this.__img.src && this.__img.src.indexOf(src) != -1) {
|
|
198
198
|
return this.__img;
|
|
199
199
|
}
|
|
@@ -219,7 +219,7 @@ export default class jmImage extends jmControl {
|
|
|
219
219
|
else {
|
|
220
220
|
this.__img = src;
|
|
221
221
|
}
|
|
222
|
-
this.image = this.__img.src;
|
|
222
|
+
//this.image = this.__img.src;
|
|
223
223
|
return this.__img;
|
|
224
224
|
}
|
|
225
225
|
}
|
package/src/shapes/jmLabel.js
CHANGED
|
@@ -118,14 +118,14 @@ export default class jmLabel extends jmControl {
|
|
|
118
118
|
this.context.save && this.context.save();
|
|
119
119
|
// 修改字体,用来计算
|
|
120
120
|
this.setStyle({
|
|
121
|
-
font: this.style.font ||
|
|
121
|
+
font: this.style.font || `${this.style.fontSize}px "${this.style.fontFamily}"`
|
|
122
122
|
});
|
|
123
123
|
//计算宽度
|
|
124
124
|
this.__size = this.context.measureText?
|
|
125
125
|
this.context.measureText(this.text):
|
|
126
126
|
{width:15};
|
|
127
127
|
this.context.restore && this.context.restore();
|
|
128
|
-
this.__size.height = this.style.fontSize?this.style.fontSize:15;
|
|
128
|
+
if(!this.__size.height) this.__size.height = this.style.fontSize? this.style.fontSize: 15;
|
|
129
129
|
if(!this.width) this.width = this.__size.width;
|
|
130
130
|
if(!this.height) this.height = this.__size.height;
|
|
131
131
|
return this.__size;
|