jmchart 1.1.93 → 1.1.94

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.
@@ -7976,10 +7976,20 @@ define(['exports'], function (exports) { 'use strict';
7976
7976
  }); // 移动标线
7977
7977
 
7978
7978
  graph.on('mousemove touchmove', args => {
7979
- const ox = args.position.x - touchStartPos.x;
7980
- const oy = args.position.y - touchStartPos.y;
7981
- const offpos = Math.sqrt(ox * ox + oy * oy);
7982
- if (longtap === 1 && offpos > 15) longtap = 0; // 如果移动了,则取消长按
7979
+ args.offsetInfo = {
7980
+ x: 0,
7981
+ y: 0,
7982
+ offset: 0
7983
+ };
7984
+ args.offsetInfo.x = args.position.x - touchStartPos.x;
7985
+ args.offsetInfo.y = args.position.y - touchStartPos.y;
7986
+ args.offsetInfo.offset = Math.sqrt(args.offsetInfo.x * args.offsetInfo.x + args.offsetInfo.y * args.offsetInfo.y); // 记录当次滑动的位置
7987
+
7988
+ touchStartPos = args.position; // 如果是长按启用,但手指又滑动了。则取消标线
7989
+
7990
+ if (longtap === 1) {
7991
+ if (args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
7992
+ }
7983
7993
 
7984
7994
  args.longtap = longtap;
7985
7995
  this.move(args);
@@ -7978,10 +7978,20 @@ class jmMarkLineManager {
7978
7978
  }); // 移动标线
7979
7979
 
7980
7980
  graph.on('mousemove touchmove', args => {
7981
- const ox = args.position.x - touchStartPos.x;
7982
- const oy = args.position.y - touchStartPos.y;
7983
- const offpos = Math.sqrt(ox * ox + oy * oy);
7984
- if (longtap === 1 && offpos > 15) longtap = 0; // 如果移动了,则取消长按
7981
+ args.offsetInfo = {
7982
+ x: 0,
7983
+ y: 0,
7984
+ offset: 0
7985
+ };
7986
+ args.offsetInfo.x = args.position.x - touchStartPos.x;
7987
+ args.offsetInfo.y = args.position.y - touchStartPos.y;
7988
+ args.offsetInfo.offset = Math.sqrt(args.offsetInfo.x * args.offsetInfo.x + args.offsetInfo.y * args.offsetInfo.y); // 记录当次滑动的位置
7989
+
7990
+ touchStartPos = args.position; // 如果是长按启用,但手指又滑动了。则取消标线
7991
+
7992
+ if (longtap === 1) {
7993
+ if (args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
7994
+ }
7985
7995
 
7986
7996
  args.longtap = longtap;
7987
7997
  this.move(args);
@@ -7974,10 +7974,20 @@ class jmMarkLineManager {
7974
7974
  }); // 移动标线
7975
7975
 
7976
7976
  graph.on('mousemove touchmove', args => {
7977
- const ox = args.position.x - touchStartPos.x;
7978
- const oy = args.position.y - touchStartPos.y;
7979
- const offpos = Math.sqrt(ox * ox + oy * oy);
7980
- if (longtap === 1 && offpos > 15) longtap = 0; // 如果移动了,则取消长按
7977
+ args.offsetInfo = {
7978
+ x: 0,
7979
+ y: 0,
7980
+ offset: 0
7981
+ };
7982
+ args.offsetInfo.x = args.position.x - touchStartPos.x;
7983
+ args.offsetInfo.y = args.position.y - touchStartPos.y;
7984
+ args.offsetInfo.offset = Math.sqrt(args.offsetInfo.x * args.offsetInfo.x + args.offsetInfo.y * args.offsetInfo.y); // 记录当次滑动的位置
7985
+
7986
+ touchStartPos = args.position; // 如果是长按启用,但手指又滑动了。则取消标线
7987
+
7988
+ if (longtap === 1) {
7989
+ if (args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
7990
+ }
7981
7991
 
7982
7992
  args.longtap = longtap;
7983
7993
  this.move(args);
@@ -7977,10 +7977,20 @@
7977
7977
  }); // 移动标线
7978
7978
 
7979
7979
  graph.on('mousemove touchmove', args => {
7980
- const ox = args.position.x - touchStartPos.x;
7981
- const oy = args.position.y - touchStartPos.y;
7982
- const offpos = Math.sqrt(ox * ox + oy * oy);
7983
- if (longtap === 1 && offpos > 15) longtap = 0; // 如果移动了,则取消长按
7980
+ args.offsetInfo = {
7981
+ x: 0,
7982
+ y: 0,
7983
+ offset: 0
7984
+ };
7985
+ args.offsetInfo.x = args.position.x - touchStartPos.x;
7986
+ args.offsetInfo.y = args.position.y - touchStartPos.y;
7987
+ args.offsetInfo.offset = Math.sqrt(args.offsetInfo.x * args.offsetInfo.x + args.offsetInfo.y * args.offsetInfo.y); // 记录当次滑动的位置
7988
+
7989
+ touchStartPos = args.position; // 如果是长按启用,但手指又滑动了。则取消标线
7990
+
7991
+ if (longtap === 1) {
7992
+ if (args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
7993
+ }
7984
7994
 
7985
7995
  args.longtap = longtap;
7986
7996
  this.move(args);
@@ -7979,10 +7979,20 @@ System.register([], function (exports) {
7979
7979
  }); // 移动标线
7980
7980
 
7981
7981
  graph.on('mousemove touchmove', args => {
7982
- const ox = args.position.x - touchStartPos.x;
7983
- const oy = args.position.y - touchStartPos.y;
7984
- const offpos = Math.sqrt(ox * ox + oy * oy);
7985
- if (longtap === 1 && offpos > 15) longtap = 0; // 如果移动了,则取消长按
7982
+ args.offsetInfo = {
7983
+ x: 0,
7984
+ y: 0,
7985
+ offset: 0
7986
+ };
7987
+ args.offsetInfo.x = args.position.x - touchStartPos.x;
7988
+ args.offsetInfo.y = args.position.y - touchStartPos.y;
7989
+ args.offsetInfo.offset = Math.sqrt(args.offsetInfo.x * args.offsetInfo.x + args.offsetInfo.y * args.offsetInfo.y); // 记录当次滑动的位置
7990
+
7991
+ touchStartPos = args.position; // 如果是长按启用,但手指又滑动了。则取消标线
7992
+
7993
+ if (longtap === 1) {
7994
+ if (args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
7995
+ }
7986
7996
 
7987
7997
  args.longtap = longtap;
7988
7998
  this.move(args);
package/example/bar.html CHANGED
@@ -53,7 +53,7 @@
53
53
  y: true
54
54
  },
55
55
  markLine: {
56
- longtap: true // 长按才出现标线
56
+ longtap: false // 长按才出现标线
57
57
  },
58
58
  margin: {
59
59
  bottom: 2
@@ -66,14 +66,28 @@
66
66
 
67
67
  // touch改变数据点事件
68
68
  chart.on('touchPointChange', function(args) {
69
- console.log(args);
69
+ //console.log(args);
70
70
  });
71
71
 
72
+ var lineTouchIng = 0;// 1=启用标线状态,2=非标线,则可以触发系统行为
72
73
  chart.on('marklinestartmove', (args)=>{
73
- if(args.event) {
74
- args.event.preventDefault(); // 阻止默认行为
74
+ lineTouchIng = 0;
75
+ });
76
+
77
+
78
+ chart.on('marklinemove', (args)=>{
79
+ if(args.event && args.offsetInfo) {
75
80
  args.event.stopPropagation();
76
- }
81
+ // 标线状态一直禁用系统能力
82
+ if((lineTouchIng === 0 && Math.abs(args.offsetInfo.y) <= 10) || lineTouchIng === 1) {
83
+ lineTouchIng = 1;
84
+ args.event.preventDefault(); // 阻止默认行为
85
+ }
86
+ else {
87
+ if(lineTouchIng === 0) lineTouchIng = 2;
88
+ console.log('marklinemove', args);
89
+ }
90
+ }
77
91
  });
78
92
 
79
93
 
@@ -94,7 +108,7 @@
94
108
  color: 'transparent'
95
109
  },
96
110
  fill: function(point) {
97
- console.log(point);
111
+ //console.log(point);
98
112
  if(point.yValue < 0) return 'green';
99
113
  else return 'red';
100
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmchart",
3
- "version": "1.1.93",
3
+ "version": "1.1.94",
4
4
  "description": "chart",
5
5
  "main": "./index.js",
6
6
  "directories": {
@@ -87,11 +87,22 @@ export default class jmMarkLineManager {
87
87
  });
88
88
  // 移动标线
89
89
  graph.on('mousemove touchmove', (args) => {
90
- const ox = args.position.x - touchStartPos.x;
91
- const oy = args.position.y - touchStartPos.y;
92
- const offpos = Math.sqrt(ox * ox + oy * oy);
93
- if(longtap === 1 && offpos > 15) longtap = 0; // 如果移动了,则取消长按
90
+ args.offsetInfo = {
91
+ x: 0,
92
+ y: 0,
93
+ offset: 0
94
+ };
95
+ args.offsetInfo.x = args.position.x - touchStartPos.x;
96
+ args.offsetInfo.y = args.position.y - touchStartPos.y;
97
+ args.offsetInfo.offset = Math.sqrt(args.offsetInfo.x * args.offsetInfo.x + args.offsetInfo.y * args.offsetInfo.y);
98
+
99
+ // 记录当次滑动的位置
100
+ touchStartPos = args.position;
94
101
 
102
+ // 如果是长按启用,但手指又滑动了。则取消标线
103
+ if(longtap === 1) {
104
+ if(args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
105
+ }
95
106
  args.longtap = longtap;
96
107
  this.move(args);
97
108
  });