jmchart 1.1.94 → 1.1.95

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.
@@ -7936,13 +7936,16 @@ define(['exports'], function (exports) { 'use strict';
7936
7936
 
7937
7937
  let longtap = 0; // 是否有长按, 0 未开始,1已按下,2识别为长按
7938
7938
 
7939
+ let lineTouching = 0; // 1=启用标线状态,2=非标线,则可以触发系统行为
7940
+
7939
7941
  let longtapHandler = 0;
7940
7942
  let touchStartPos = {
7941
7943
  x: 0,
7942
7944
  y: 0
7943
7945
  };
7944
7946
  graph.on('mousedown touchstart', args => {
7945
- // 如果长按才启用
7947
+ lineTouching = 0; // 如果长按才启用
7948
+
7946
7949
  if (chart.style.markLine.longtap) {
7947
7950
  longtap = 1;
7948
7951
  longtapHandler && graph.utils.cancelAnimationFrame(longtapHandler);
@@ -7989,14 +7992,27 @@ define(['exports'], function (exports) { 'use strict';
7989
7992
 
7990
7993
  if (longtap === 1) {
7991
7994
  if (args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
7995
+ else lineTouching = 1;
7996
+ }
7997
+
7998
+ args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
7999
+
8000
+ if (chart.style.markLine.lock) {
8001
+ // 标线状态一直禁用系统能力
8002
+ if (lineTouching === 0 && (chart.style.markLine.lock.y && Math.abs(args.offsetInfo.y) < chart.style.markLine.lock.y || chart.style.markLine.lock.x && Math.abs(args.offsetInfo.x) < chart.style.markLine.lock.x) || lineTouching === 1) {
8003
+ lineTouching = 1;
8004
+ args.event.preventDefault(); // 阻止默认行为
8005
+ }
7992
8006
  }
7993
8007
 
8008
+ if (lineTouching === 0) lineTouching = 2;
7994
8009
  args.longtap = longtap;
7995
8010
  this.move(args);
7996
8011
  }); // 取消移动
7997
8012
 
7998
8013
  graph.on('mouseup touchend touchcancel touchleave', args => {
7999
8014
  longtap = 0;
8015
+ lineTouching = 0;
8000
8016
  this.endMove(args);
8001
8017
  });
8002
8018
  }
@@ -7938,13 +7938,16 @@ class jmMarkLineManager {
7938
7938
 
7939
7939
  let longtap = 0; // 是否有长按, 0 未开始,1已按下,2识别为长按
7940
7940
 
7941
+ let lineTouching = 0; // 1=启用标线状态,2=非标线,则可以触发系统行为
7942
+
7941
7943
  let longtapHandler = 0;
7942
7944
  let touchStartPos = {
7943
7945
  x: 0,
7944
7946
  y: 0
7945
7947
  };
7946
7948
  graph.on('mousedown touchstart', args => {
7947
- // 如果长按才启用
7949
+ lineTouching = 0; // 如果长按才启用
7950
+
7948
7951
  if (chart.style.markLine.longtap) {
7949
7952
  longtap = 1;
7950
7953
  longtapHandler && graph.utils.cancelAnimationFrame(longtapHandler);
@@ -7991,14 +7994,27 @@ class jmMarkLineManager {
7991
7994
 
7992
7995
  if (longtap === 1) {
7993
7996
  if (args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
7997
+ else lineTouching = 1;
7998
+ }
7999
+
8000
+ args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8001
+
8002
+ if (chart.style.markLine.lock) {
8003
+ // 标线状态一直禁用系统能力
8004
+ if (lineTouching === 0 && (chart.style.markLine.lock.y && Math.abs(args.offsetInfo.y) < chart.style.markLine.lock.y || chart.style.markLine.lock.x && Math.abs(args.offsetInfo.x) < chart.style.markLine.lock.x) || lineTouching === 1) {
8005
+ lineTouching = 1;
8006
+ args.event.preventDefault(); // 阻止默认行为
8007
+ }
7994
8008
  }
7995
8009
 
8010
+ if (lineTouching === 0) lineTouching = 2;
7996
8011
  args.longtap = longtap;
7997
8012
  this.move(args);
7998
8013
  }); // 取消移动
7999
8014
 
8000
8015
  graph.on('mouseup touchend touchcancel touchleave', args => {
8001
8016
  longtap = 0;
8017
+ lineTouching = 0;
8002
8018
  this.endMove(args);
8003
8019
  });
8004
8020
  }
@@ -7934,13 +7934,16 @@ class jmMarkLineManager {
7934
7934
 
7935
7935
  let longtap = 0; // 是否有长按, 0 未开始,1已按下,2识别为长按
7936
7936
 
7937
+ let lineTouching = 0; // 1=启用标线状态,2=非标线,则可以触发系统行为
7938
+
7937
7939
  let longtapHandler = 0;
7938
7940
  let touchStartPos = {
7939
7941
  x: 0,
7940
7942
  y: 0
7941
7943
  };
7942
7944
  graph.on('mousedown touchstart', args => {
7943
- // 如果长按才启用
7945
+ lineTouching = 0; // 如果长按才启用
7946
+
7944
7947
  if (chart.style.markLine.longtap) {
7945
7948
  longtap = 1;
7946
7949
  longtapHandler && graph.utils.cancelAnimationFrame(longtapHandler);
@@ -7987,14 +7990,27 @@ class jmMarkLineManager {
7987
7990
 
7988
7991
  if (longtap === 1) {
7989
7992
  if (args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
7993
+ else lineTouching = 1;
7994
+ }
7995
+
7996
+ args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
7997
+
7998
+ if (chart.style.markLine.lock) {
7999
+ // 标线状态一直禁用系统能力
8000
+ if (lineTouching === 0 && (chart.style.markLine.lock.y && Math.abs(args.offsetInfo.y) < chart.style.markLine.lock.y || chart.style.markLine.lock.x && Math.abs(args.offsetInfo.x) < chart.style.markLine.lock.x) || lineTouching === 1) {
8001
+ lineTouching = 1;
8002
+ args.event.preventDefault(); // 阻止默认行为
8003
+ }
7990
8004
  }
7991
8005
 
8006
+ if (lineTouching === 0) lineTouching = 2;
7992
8007
  args.longtap = longtap;
7993
8008
  this.move(args);
7994
8009
  }); // 取消移动
7995
8010
 
7996
8011
  graph.on('mouseup touchend touchcancel touchleave', args => {
7997
8012
  longtap = 0;
8013
+ lineTouching = 0;
7998
8014
  this.endMove(args);
7999
8015
  });
8000
8016
  }
@@ -7937,13 +7937,16 @@
7937
7937
 
7938
7938
  let longtap = 0; // 是否有长按, 0 未开始,1已按下,2识别为长按
7939
7939
 
7940
+ let lineTouching = 0; // 1=启用标线状态,2=非标线,则可以触发系统行为
7941
+
7940
7942
  let longtapHandler = 0;
7941
7943
  let touchStartPos = {
7942
7944
  x: 0,
7943
7945
  y: 0
7944
7946
  };
7945
7947
  graph.on('mousedown touchstart', args => {
7946
- // 如果长按才启用
7948
+ lineTouching = 0; // 如果长按才启用
7949
+
7947
7950
  if (chart.style.markLine.longtap) {
7948
7951
  longtap = 1;
7949
7952
  longtapHandler && graph.utils.cancelAnimationFrame(longtapHandler);
@@ -7990,14 +7993,27 @@
7990
7993
 
7991
7994
  if (longtap === 1) {
7992
7995
  if (args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
7996
+ else lineTouching = 1;
7997
+ }
7998
+
7999
+ args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8000
+
8001
+ if (chart.style.markLine.lock) {
8002
+ // 标线状态一直禁用系统能力
8003
+ if (lineTouching === 0 && (chart.style.markLine.lock.y && Math.abs(args.offsetInfo.y) < chart.style.markLine.lock.y || chart.style.markLine.lock.x && Math.abs(args.offsetInfo.x) < chart.style.markLine.lock.x) || lineTouching === 1) {
8004
+ lineTouching = 1;
8005
+ args.event.preventDefault(); // 阻止默认行为
8006
+ }
7993
8007
  }
7994
8008
 
8009
+ if (lineTouching === 0) lineTouching = 2;
7995
8010
  args.longtap = longtap;
7996
8011
  this.move(args);
7997
8012
  }); // 取消移动
7998
8013
 
7999
8014
  graph.on('mouseup touchend touchcancel touchleave', args => {
8000
8015
  longtap = 0;
8016
+ lineTouching = 0;
8001
8017
  this.endMove(args);
8002
8018
  });
8003
8019
  }
@@ -7939,13 +7939,16 @@ System.register([], function (exports) {
7939
7939
 
7940
7940
  let longtap = 0; // 是否有长按, 0 未开始,1已按下,2识别为长按
7941
7941
 
7942
+ let lineTouching = 0; // 1=启用标线状态,2=非标线,则可以触发系统行为
7943
+
7942
7944
  let longtapHandler = 0;
7943
7945
  let touchStartPos = {
7944
7946
  x: 0,
7945
7947
  y: 0
7946
7948
  };
7947
7949
  graph.on('mousedown touchstart', args => {
7948
- // 如果长按才启用
7950
+ lineTouching = 0; // 如果长按才启用
7951
+
7949
7952
  if (chart.style.markLine.longtap) {
7950
7953
  longtap = 1;
7951
7954
  longtapHandler && graph.utils.cancelAnimationFrame(longtapHandler);
@@ -7992,14 +7995,27 @@ System.register([], function (exports) {
7992
7995
 
7993
7996
  if (longtap === 1) {
7994
7997
  if (args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
7998
+ else lineTouching = 1;
7999
+ }
8000
+
8001
+ args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8002
+
8003
+ if (chart.style.markLine.lock) {
8004
+ // 标线状态一直禁用系统能力
8005
+ if (lineTouching === 0 && (chart.style.markLine.lock.y && Math.abs(args.offsetInfo.y) < chart.style.markLine.lock.y || chart.style.markLine.lock.x && Math.abs(args.offsetInfo.x) < chart.style.markLine.lock.x) || lineTouching === 1) {
8006
+ lineTouching = 1;
8007
+ args.event.preventDefault(); // 阻止默认行为
8008
+ }
7995
8009
  }
7996
8010
 
8011
+ if (lineTouching === 0) lineTouching = 2;
7997
8012
  args.longtap = longtap;
7998
8013
  this.move(args);
7999
8014
  }); // 取消移动
8000
8015
 
8001
8016
  graph.on('mouseup touchend touchcancel touchleave', args => {
8002
8017
  longtap = 0;
8018
+ lineTouching = 0;
8003
8019
  this.endMove(args);
8004
8020
  });
8005
8021
  }
package/example/bar.html CHANGED
@@ -53,7 +53,11 @@
53
53
  y: true
54
54
  },
55
55
  markLine: {
56
- longtap: false // 长按才出现标线
56
+ longtap: false, // 长按才出现标线
57
+ lock: {
58
+ y: 10,
59
+ x: 10
60
+ }
57
61
  },
58
62
  margin: {
59
63
  bottom: 2
@@ -69,25 +73,13 @@
69
73
  //console.log(args);
70
74
  });
71
75
 
72
- var lineTouchIng = 0;// 1=启用标线状态,2=非标线,则可以触发系统行为
73
76
  chart.on('marklinestartmove', (args)=>{
74
- lineTouchIng = 0;
77
+
75
78
  });
76
79
 
77
80
 
78
81
  chart.on('marklinemove', (args)=>{
79
- if(args.event && args.offsetInfo) {
80
- args.event.stopPropagation();
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
- }
82
+
91
83
  });
92
84
 
93
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmchart",
3
- "version": "1.1.94",
3
+ "version": "1.1.95",
4
4
  "description": "chart",
5
5
  "main": "./index.js",
6
6
  "directories": {
@@ -48,13 +48,15 @@ export default class jmMarkLineManager {
48
48
  area.children.add(this.yMarkLine);
49
49
  }
50
50
 
51
- let longtap = 0;// 是否有长按, 0 未开始,1已按下,2识别为长按
51
+ let longtap = 0; // 是否有长按, 0 未开始,1已按下,2识别为长按
52
+ let lineTouching = 0; // 1=启用标线状态,2=非标线,则可以触发系统行为
52
53
  let longtapHandler = 0;
53
54
  let touchStartPos = {
54
55
  x: 0,
55
56
  y: 0
56
57
  };
57
58
  graph.on('mousedown touchstart', (args) => {
59
+ lineTouching = 0;
58
60
  // 如果长按才启用
59
61
  if(chart.style.markLine.longtap) {
60
62
  longtap = 1;
@@ -102,14 +104,33 @@ export default class jmMarkLineManager {
102
104
  // 如果是长按启用,但手指又滑动了。则取消标线
103
105
  if(longtap === 1) {
104
106
  if(args.offsetInfo.offset > 15) longtap = 0; // 如果移动了,则取消长按
107
+ else lineTouching = 1;
105
108
  }
109
+
110
+ args.event.stopPropagation();
111
+ // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
112
+ if(chart.style.markLine.lock){
113
+ // 标线状态一直禁用系统能力
114
+ // 如果指定了锁定值,只需要一项符合要求就进行锁定
115
+ if((lineTouching === 0 &&
116
+ ((chart.style.markLine.lock.y && Math.abs(args.offsetInfo.y) < chart.style.markLine.lock.y) ||
117
+ (chart.style.markLine.lock.x && Math.abs(args.offsetInfo.x) < chart.style.markLine.lock.x)))
118
+ || lineTouching === 1) {
119
+
120
+ lineTouching = 1;
121
+ args.event.preventDefault(); // 阻止默认行为
122
+ }
123
+ }
124
+
125
+ if(lineTouching === 0) lineTouching = 2;
126
+
106
127
  args.longtap = longtap;
107
128
  this.move(args);
108
129
  });
109
130
  // 取消移动
110
131
  graph.on('mouseup touchend touchcancel touchleave', (args) => {
111
132
  longtap = 0;
112
-
133
+ lineTouching = 0;
113
134
  this.endMove(args);
114
135
  });
115
136
  }