jmgraph 3.2.19 → 3.2.21
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/README.md +311 -6
- package/dist/jmgraph.core.min.js +1 -1
- package/dist/jmgraph.core.min.js.map +1 -1
- package/dist/jmgraph.js +2022 -368
- package/dist/jmgraph.min.js +1 -1
- package/index.js +23 -25
- package/package.json +1 -1
- package/src/core/jmControl.js +199 -30
- package/src/core/jmFilter.js +150 -0
- package/src/core/jmGraph.js +207 -7
- package/src/core/jmLayer.js +142 -0
- package/src/core/jmPath.js +55 -0
- package/src/core/jmUtils.js +46 -37
- package/src/lib/webgl/base.js +10 -36
- package/src/lib/webgl/gradient.js +16 -3
- package/src/lib/webgl/index.js +5 -4
- package/src/lib/webgl/path.js +156 -33
- package/src/shapes/jmEllipse.js +91 -0
- package/src/shapes/jmLabel.js +126 -75
- package/src/shapes/jmPolygon.js +129 -0
- package/src/shapes/jmRect.js +107 -29
- package/src/shapes/jmStar.js +160 -0
- package/example/ball.html +0 -217
- package/example/base.html +0 -112
- package/example/canvas.html +0 -54
- package/example/cell.html +0 -284
- package/example/controls/arc.html +0 -129
- package/example/controls/arrowline.html +0 -78
- package/example/controls/bezier.html +0 -299
- package/example/controls/img.html +0 -97
- package/example/controls/label.html +0 -87
- package/example/controls/line.html +0 -173
- package/example/controls/prismatic.html +0 -63
- package/example/controls/rect.html +0 -64
- package/example/controls/resize.html +0 -112
- package/example/controls/test.html +0 -360
- package/example/es.html +0 -70
- package/example/es5module.html +0 -63
- package/example/heartarc.html +0 -116
- package/example/index.html +0 -47
- package/example/js/require.js +0 -5
- package/example/love/img/bling/bling.tps +0 -265
- package/example/love/img/bling.json +0 -87
- package/example/love/img/bling.tps +0 -295
- package/example/love/img/doc/bling.gif +0 -0
- package/example/love/img/love.json +0 -95
- package/example/love/img/love.tps +0 -315
- package/example/love/img/qq/qq.tps +0 -399
- package/example/love/img/qq.json +0 -242
- package/example/love/index.html +0 -40
- package/example/love/js/game.js +0 -558
- package/example/music.html +0 -211
- package/example/node/test.js +0 -138
- package/example/pdf.html +0 -187
- package/example/progress.html +0 -173
- package/example/pso.html +0 -148
- package/example/sort.html +0 -805
- package/example/tweenjs.html +0 -84
- package/example/webgl.html +0 -278
- package/example/xfj/img/dr_die.gif +0 -0
- package/example/xfj/index.html +0 -332
- package/example/xfj/shake.js +0 -49
- package/example/xfj/testori.html +0 -76
package/example/xfj/shake.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
function devicemotion() {
|
|
2
|
-
|
|
3
|
-
this.hasDeviceMotion = 'ondeviceorientation' in window;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
devicemotion.prototype.initEvent = function() {
|
|
7
|
-
if(this.inited) return;
|
|
8
|
-
if(this.hasDeviceMotion) {
|
|
9
|
-
var self = this;
|
|
10
|
-
window.addEventListener('deviceorientation',function(e) {
|
|
11
|
-
self.devicemotionEvent(e);
|
|
12
|
-
}, false);
|
|
13
|
-
}
|
|
14
|
-
this.inited = true;
|
|
15
|
-
return this.hasDeviceMotion;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
//绑定摇一摇功能
|
|
19
|
-
//如果不支持摇一摇,则会返回false
|
|
20
|
-
devicemotion.prototype.bindShake = function(options) {
|
|
21
|
-
if(!options) return;
|
|
22
|
-
|
|
23
|
-
if(this.hasDeviceMotion) {
|
|
24
|
-
this.shakeOption = options;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
options.handler && options.handler();
|
|
28
|
-
}
|
|
29
|
-
this.initEvent();
|
|
30
|
-
return this.hasDeviceMotion;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
devicemotion.prototype.devicemotionEvent = function(e) {
|
|
34
|
-
|
|
35
|
-
//以设备坐标系z轴为轴,旋转alpha度
|
|
36
|
-
//以设备坐标系x轴为轴,旋转beta度
|
|
37
|
-
//已设备坐标系y轴为轴,旋转gamma度
|
|
38
|
-
if(this.shakeOption) {
|
|
39
|
-
var opt = {
|
|
40
|
-
//x: e.accelerationIncludingGravity.x,
|
|
41
|
-
// y: e.accelerationIncludingGravity.y,
|
|
42
|
-
//z: e.accelerationIncludingGravity.z,
|
|
43
|
-
alpha: e.alpha,
|
|
44
|
-
beta: e.beta,
|
|
45
|
-
gamma: e.gamma
|
|
46
|
-
}
|
|
47
|
-
this.shakeOption.handler.call(this, opt);
|
|
48
|
-
}
|
|
49
|
-
}
|
package/example/xfj/testori.html
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<title>Device Orientation By PuterJam</title>
|
|
6
|
-
|
|
7
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<h1><ruby>设备方向感应测试<rt style="text-align:right;color:#ccc;font-size:10px">By PuterJam</rt></ruby></h1>
|
|
11
|
-
<div style="background:#000;width:400px;height:200px;color:#fff;border-radius:5px;">
|
|
12
|
-
<div id="pointer" style="height:5px;width:5px;background:#fff;position:relative;border-radius:10px;-webkit-transition:all 0.1s ease-in;-moz-transition:all 0.1s ease-in">
|
|
13
|
-
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
<div id="test" style="font-size:12px;-webkit-text-size-adjust:none;margin:6px;"></div>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<script defer>
|
|
20
|
-
function Orientation(selector) {
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
Orientation.prototype.init = function(){
|
|
25
|
-
window.addEventListener('deviceorientation', this.orientationListener, false);
|
|
26
|
-
window.addEventListener('MozOrientation', this.orientationListener, false);
|
|
27
|
-
window.addEventListener('devicemotion', this.orientationListener, false);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
Orientation.prototype.orientationListener = function(evt) {
|
|
31
|
-
// For FF3.6+
|
|
32
|
-
if (!evt.gamma && !evt.beta) {
|
|
33
|
-
// angle=radian*180.0/PI 在firefox中x和y是弧度值,
|
|
34
|
-
evt.gamma = (evt.x * (180 / Math.PI)); //转换成角度值,
|
|
35
|
-
evt.beta = (evt.y * (180 / Math.PI)); //转换成角度值
|
|
36
|
-
evt.alpha = (evt.z * (180 / Math.PI)); //转换成角度值
|
|
37
|
-
}
|
|
38
|
-
/* beta: -180..180 (rotation around x axis) */
|
|
39
|
-
/* gamma: -90..90 (rotation around y axis) */
|
|
40
|
-
/* alpha: 0..360 (rotation around z axis) (-180..180) */
|
|
41
|
-
|
|
42
|
-
var gamma = evt.gamma
|
|
43
|
-
var beta = evt.beta
|
|
44
|
-
var alpha = evt.alpha
|
|
45
|
-
|
|
46
|
-
if(evt.accelerationIncludingGravity){
|
|
47
|
-
// window.removeEventListener('deviceorientation', this.orientationListener, false);
|
|
48
|
-
gamma = event.accelerationIncludingGravity.x*10
|
|
49
|
-
beta = -event.accelerationIncludingGravity.y*10
|
|
50
|
-
alpha = event.accelerationIncludingGravity.z*10
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
//var gamma = evt.rotationRate.gamma;
|
|
54
|
-
//var beta = evt.rotationRate.beta;
|
|
55
|
-
//var alpha = evt.rotationRate.beta;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (this._lastGamma != gamma || this._lastBeta != beta) {
|
|
61
|
-
document.querySelector("#test").innerHTML = "x: "+ beta.toFixed(2) + " y: " + gamma.toFixed(2) + " z: " + (alpha != null?alpha.toFixed(2):0)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var style = document.querySelector("#pointer").style;
|
|
65
|
-
style.left = (gamma+20)/40*400 +"px";
|
|
66
|
-
style.top = beta/90 * 100 + 100 +"px";
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
this._lastGamma = gamma;
|
|
70
|
-
this._lastBeta = beta;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
(new Orientation()).init();
|
|
74
|
-
</script>
|
|
75
|
-
</body>
|
|
76
|
-
</html>
|