jmgraph 3.2.18 → 3.2.20

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.
Files changed (57) hide show
  1. package/README.md +174 -2
  2. package/dist/jmgraph.core.min.js +1 -1
  3. package/dist/jmgraph.core.min.js.map +1 -1
  4. package/dist/jmgraph.js +1672 -147
  5. package/dist/jmgraph.min.js +1 -1
  6. package/index.js +13 -2
  7. package/package.json +1 -1
  8. package/src/core/jmGraph.js +460 -5
  9. package/src/core/jmLayer.js +142 -0
  10. package/src/core/jmPath.js +55 -0
  11. package/src/lib/webgl/base.js +6 -0
  12. package/src/lib/webgl/path.js +8 -11
  13. package/src/shapes/jmEllipse.js +91 -0
  14. package/src/shapes/jmLabel.js +127 -15
  15. package/src/shapes/jmPolygon.js +129 -0
  16. package/src/shapes/jmStar.js +160 -0
  17. package/example/ball.html +0 -217
  18. package/example/base.html +0 -112
  19. package/example/canvas.html +0 -54
  20. package/example/cell.html +0 -284
  21. package/example/controls/arc.html +0 -129
  22. package/example/controls/arrowline.html +0 -78
  23. package/example/controls/bezier.html +0 -299
  24. package/example/controls/img.html +0 -97
  25. package/example/controls/label.html +0 -87
  26. package/example/controls/line.html +0 -173
  27. package/example/controls/prismatic.html +0 -63
  28. package/example/controls/rect.html +0 -64
  29. package/example/controls/resize.html +0 -112
  30. package/example/controls/test.html +0 -360
  31. package/example/es.html +0 -70
  32. package/example/es5module.html +0 -63
  33. package/example/heartarc.html +0 -116
  34. package/example/index.html +0 -47
  35. package/example/js/require.js +0 -5
  36. package/example/love/img/bling/bling.tps +0 -265
  37. package/example/love/img/bling.json +0 -87
  38. package/example/love/img/bling.tps +0 -295
  39. package/example/love/img/doc/bling.gif +0 -0
  40. package/example/love/img/love.json +0 -95
  41. package/example/love/img/love.tps +0 -315
  42. package/example/love/img/qq/qq.tps +0 -399
  43. package/example/love/img/qq.json +0 -242
  44. package/example/love/index.html +0 -40
  45. package/example/love/js/game.js +0 -558
  46. package/example/music.html +0 -211
  47. package/example/node/test.js +0 -138
  48. package/example/pdf.html +0 -187
  49. package/example/progress.html +0 -173
  50. package/example/pso.html +0 -148
  51. package/example/sort.html +0 -805
  52. package/example/tweenjs.html +0 -84
  53. package/example/webgl.html +0 -278
  54. package/example/xfj/img/dr_die.gif +0 -0
  55. package/example/xfj/index.html +0 -332
  56. package/example/xfj/shake.js +0 -49
  57. package/example/xfj/testori.html +0 -76
@@ -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
- }
@@ -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>