jmchart 1.2.1 → 1.2.2

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.
@@ -1838,9 +1838,6 @@ define(['exports'], function (exports) { 'use strict';
1838
1838
  if(typeof this.canvas.width === 'function') {
1839
1839
  rect.right = this.canvas.width();
1840
1840
  }
1841
- else if(this.canvas.width) {
1842
- rect.right = this.canvas.width;
1843
- }
1844
1841
  else if(this.width) {
1845
1842
  rect.right = this.width;
1846
1843
  }
@@ -1848,9 +1845,6 @@ define(['exports'], function (exports) { 'use strict';
1848
1845
  if(typeof this.canvas.height === 'function') {
1849
1846
  rect.bottom = this.canvas.height();
1850
1847
  }
1851
- else if(this.canvas.height) {
1852
- rect.bottom = this.canvas.height;
1853
- }
1854
1848
  else if(this.height) {
1855
1849
  rect.bottom = this.height;
1856
1850
  }
@@ -2345,8 +2339,8 @@ define(['exports'], function (exports) { 'use strict';
2345
2339
  //获取dom位置
2346
2340
  let position = this.getPosition();
2347
2341
  // 由于高清屏会有放大坐标,所以这里用pagex就只能用真实的canvas大小
2348
- const right = position.left + (this.canvas.clientWidth || this.canvas.offsetWidth || this.canvas.width);
2349
- const bottom = position.top + (this.canvas.clientHeight || this.canvas.offsetHeight || this.canvas.height);
2342
+ const right = position.left + this.width;
2343
+ const bottom = position.top + this.height;
2350
2344
  if(p.pageX > right || p.pageX < position.left) {
2351
2345
  return false;
2352
2346
  }
@@ -4821,8 +4815,8 @@ define(['exports'], function (exports) { 'use strict';
4821
4815
  */
4822
4816
  getPosition() {
4823
4817
  let p = jmUtils.getElementPosition(this.canvas.canvas || this.canvas);
4824
- p.width = this.canvas.width;
4825
- p.height = this.canvas.height;
4818
+ p.width = this.width;
4819
+ p.height = this.height;
4826
4820
  p.right = p.left + p.width;
4827
4821
  p.bottom = p.top + p.height;
4828
4822
  return p;
@@ -8426,14 +8420,14 @@ define(['exports'], function (exports) { 'use strict';
8426
8420
  else lineTouching = 1;
8427
8421
  }
8428
8422
 
8429
- args.event.stopPropagation && args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8423
+ args.event && args.event.stopPropagation && args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8430
8424
 
8431
8425
  if (chart.style.markLine.lock) {
8432
8426
  // 标线状态一直禁用系统能力
8433
8427
  // 如果指定了锁定值,只需要一项符合要求就进行锁定
8434
8428
  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) {
8435
8429
  lineTouching = 1;
8436
- args.event.preventDefault(); // 阻止默认行为
8430
+ args.event && args.event.preventDefault && args.event.preventDefault(); // 阻止默认行为
8437
8431
  }
8438
8432
  }
8439
8433
 
@@ -1840,9 +1840,6 @@ class jmControl extends jmProperty {
1840
1840
  if(typeof this.canvas.width === 'function') {
1841
1841
  rect.right = this.canvas.width();
1842
1842
  }
1843
- else if(this.canvas.width) {
1844
- rect.right = this.canvas.width;
1845
- }
1846
1843
  else if(this.width) {
1847
1844
  rect.right = this.width;
1848
1845
  }
@@ -1850,9 +1847,6 @@ class jmControl extends jmProperty {
1850
1847
  if(typeof this.canvas.height === 'function') {
1851
1848
  rect.bottom = this.canvas.height();
1852
1849
  }
1853
- else if(this.canvas.height) {
1854
- rect.bottom = this.canvas.height;
1855
- }
1856
1850
  else if(this.height) {
1857
1851
  rect.bottom = this.height;
1858
1852
  }
@@ -2347,8 +2341,8 @@ class jmControl extends jmProperty {
2347
2341
  //获取dom位置
2348
2342
  let position = this.getPosition();
2349
2343
  // 由于高清屏会有放大坐标,所以这里用pagex就只能用真实的canvas大小
2350
- const right = position.left + (this.canvas.clientWidth || this.canvas.offsetWidth || this.canvas.width);
2351
- const bottom = position.top + (this.canvas.clientHeight || this.canvas.offsetHeight || this.canvas.height);
2344
+ const right = position.left + this.width;
2345
+ const bottom = position.top + this.height;
2352
2346
  if(p.pageX > right || p.pageX < position.left) {
2353
2347
  return false;
2354
2348
  }
@@ -4823,8 +4817,8 @@ class jmGraph$1 extends jmControl {
4823
4817
  */
4824
4818
  getPosition() {
4825
4819
  let p = jmUtils.getElementPosition(this.canvas.canvas || this.canvas);
4826
- p.width = this.canvas.width;
4827
- p.height = this.canvas.height;
4820
+ p.width = this.width;
4821
+ p.height = this.height;
4828
4822
  p.right = p.left + p.width;
4829
4823
  p.bottom = p.top + p.height;
4830
4824
  return p;
@@ -8428,14 +8422,14 @@ class jmMarkLineManager {
8428
8422
  else lineTouching = 1;
8429
8423
  }
8430
8424
 
8431
- args.event.stopPropagation && args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8425
+ args.event && args.event.stopPropagation && args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8432
8426
 
8433
8427
  if (chart.style.markLine.lock) {
8434
8428
  // 标线状态一直禁用系统能力
8435
8429
  // 如果指定了锁定值,只需要一项符合要求就进行锁定
8436
8430
  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) {
8437
8431
  lineTouching = 1;
8438
- args.event.preventDefault(); // 阻止默认行为
8432
+ args.event && args.event.preventDefault && args.event.preventDefault(); // 阻止默认行为
8439
8433
  }
8440
8434
  }
8441
8435
 
@@ -1836,9 +1836,6 @@ class jmControl extends jmProperty {
1836
1836
  if(typeof this.canvas.width === 'function') {
1837
1837
  rect.right = this.canvas.width();
1838
1838
  }
1839
- else if(this.canvas.width) {
1840
- rect.right = this.canvas.width;
1841
- }
1842
1839
  else if(this.width) {
1843
1840
  rect.right = this.width;
1844
1841
  }
@@ -1846,9 +1843,6 @@ class jmControl extends jmProperty {
1846
1843
  if(typeof this.canvas.height === 'function') {
1847
1844
  rect.bottom = this.canvas.height();
1848
1845
  }
1849
- else if(this.canvas.height) {
1850
- rect.bottom = this.canvas.height;
1851
- }
1852
1846
  else if(this.height) {
1853
1847
  rect.bottom = this.height;
1854
1848
  }
@@ -2343,8 +2337,8 @@ class jmControl extends jmProperty {
2343
2337
  //获取dom位置
2344
2338
  let position = this.getPosition();
2345
2339
  // 由于高清屏会有放大坐标,所以这里用pagex就只能用真实的canvas大小
2346
- const right = position.left + (this.canvas.clientWidth || this.canvas.offsetWidth || this.canvas.width);
2347
- const bottom = position.top + (this.canvas.clientHeight || this.canvas.offsetHeight || this.canvas.height);
2340
+ const right = position.left + this.width;
2341
+ const bottom = position.top + this.height;
2348
2342
  if(p.pageX > right || p.pageX < position.left) {
2349
2343
  return false;
2350
2344
  }
@@ -4819,8 +4813,8 @@ class jmGraph$1 extends jmControl {
4819
4813
  */
4820
4814
  getPosition() {
4821
4815
  let p = jmUtils.getElementPosition(this.canvas.canvas || this.canvas);
4822
- p.width = this.canvas.width;
4823
- p.height = this.canvas.height;
4816
+ p.width = this.width;
4817
+ p.height = this.height;
4824
4818
  p.right = p.left + p.width;
4825
4819
  p.bottom = p.top + p.height;
4826
4820
  return p;
@@ -8424,14 +8418,14 @@ class jmMarkLineManager {
8424
8418
  else lineTouching = 1;
8425
8419
  }
8426
8420
 
8427
- args.event.stopPropagation && args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8421
+ args.event && args.event.stopPropagation && args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8428
8422
 
8429
8423
  if (chart.style.markLine.lock) {
8430
8424
  // 标线状态一直禁用系统能力
8431
8425
  // 如果指定了锁定值,只需要一项符合要求就进行锁定
8432
8426
  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) {
8433
8427
  lineTouching = 1;
8434
- args.event.preventDefault(); // 阻止默认行为
8428
+ args.event && args.event.preventDefault && args.event.preventDefault(); // 阻止默认行为
8435
8429
  }
8436
8430
  }
8437
8431
 
@@ -1839,9 +1839,6 @@
1839
1839
  if(typeof this.canvas.width === 'function') {
1840
1840
  rect.right = this.canvas.width();
1841
1841
  }
1842
- else if(this.canvas.width) {
1843
- rect.right = this.canvas.width;
1844
- }
1845
1842
  else if(this.width) {
1846
1843
  rect.right = this.width;
1847
1844
  }
@@ -1849,9 +1846,6 @@
1849
1846
  if(typeof this.canvas.height === 'function') {
1850
1847
  rect.bottom = this.canvas.height();
1851
1848
  }
1852
- else if(this.canvas.height) {
1853
- rect.bottom = this.canvas.height;
1854
- }
1855
1849
  else if(this.height) {
1856
1850
  rect.bottom = this.height;
1857
1851
  }
@@ -2346,8 +2340,8 @@
2346
2340
  //获取dom位置
2347
2341
  let position = this.getPosition();
2348
2342
  // 由于高清屏会有放大坐标,所以这里用pagex就只能用真实的canvas大小
2349
- const right = position.left + (this.canvas.clientWidth || this.canvas.offsetWidth || this.canvas.width);
2350
- const bottom = position.top + (this.canvas.clientHeight || this.canvas.offsetHeight || this.canvas.height);
2343
+ const right = position.left + this.width;
2344
+ const bottom = position.top + this.height;
2351
2345
  if(p.pageX > right || p.pageX < position.left) {
2352
2346
  return false;
2353
2347
  }
@@ -4822,8 +4816,8 @@
4822
4816
  */
4823
4817
  getPosition() {
4824
4818
  let p = jmUtils.getElementPosition(this.canvas.canvas || this.canvas);
4825
- p.width = this.canvas.width;
4826
- p.height = this.canvas.height;
4819
+ p.width = this.width;
4820
+ p.height = this.height;
4827
4821
  p.right = p.left + p.width;
4828
4822
  p.bottom = p.top + p.height;
4829
4823
  return p;
@@ -8427,14 +8421,14 @@
8427
8421
  else lineTouching = 1;
8428
8422
  }
8429
8423
 
8430
- args.event.stopPropagation && args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8424
+ args.event && args.event.stopPropagation && args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8431
8425
 
8432
8426
  if (chart.style.markLine.lock) {
8433
8427
  // 标线状态一直禁用系统能力
8434
8428
  // 如果指定了锁定值,只需要一项符合要求就进行锁定
8435
8429
  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) {
8436
8430
  lineTouching = 1;
8437
- args.event.preventDefault(); // 阻止默认行为
8431
+ args.event && args.event.preventDefault && args.event.preventDefault(); // 阻止默认行为
8438
8432
  }
8439
8433
  }
8440
8434
 
@@ -1841,9 +1841,6 @@ System.register([], function (exports) {
1841
1841
  if(typeof this.canvas.width === 'function') {
1842
1842
  rect.right = this.canvas.width();
1843
1843
  }
1844
- else if(this.canvas.width) {
1845
- rect.right = this.canvas.width;
1846
- }
1847
1844
  else if(this.width) {
1848
1845
  rect.right = this.width;
1849
1846
  }
@@ -1851,9 +1848,6 @@ System.register([], function (exports) {
1851
1848
  if(typeof this.canvas.height === 'function') {
1852
1849
  rect.bottom = this.canvas.height();
1853
1850
  }
1854
- else if(this.canvas.height) {
1855
- rect.bottom = this.canvas.height;
1856
- }
1857
1851
  else if(this.height) {
1858
1852
  rect.bottom = this.height;
1859
1853
  }
@@ -2348,8 +2342,8 @@ System.register([], function (exports) {
2348
2342
  //获取dom位置
2349
2343
  let position = this.getPosition();
2350
2344
  // 由于高清屏会有放大坐标,所以这里用pagex就只能用真实的canvas大小
2351
- const right = position.left + (this.canvas.clientWidth || this.canvas.offsetWidth || this.canvas.width);
2352
- const bottom = position.top + (this.canvas.clientHeight || this.canvas.offsetHeight || this.canvas.height);
2345
+ const right = position.left + this.width;
2346
+ const bottom = position.top + this.height;
2353
2347
  if(p.pageX > right || p.pageX < position.left) {
2354
2348
  return false;
2355
2349
  }
@@ -4824,8 +4818,8 @@ System.register([], function (exports) {
4824
4818
  */
4825
4819
  getPosition() {
4826
4820
  let p = jmUtils.getElementPosition(this.canvas.canvas || this.canvas);
4827
- p.width = this.canvas.width;
4828
- p.height = this.canvas.height;
4821
+ p.width = this.width;
4822
+ p.height = this.height;
4829
4823
  p.right = p.left + p.width;
4830
4824
  p.bottom = p.top + p.height;
4831
4825
  return p;
@@ -8429,14 +8423,14 @@ System.register([], function (exports) {
8429
8423
  else lineTouching = 1;
8430
8424
  }
8431
8425
 
8432
- args.event.stopPropagation && args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8426
+ args.event && args.event.stopPropagation && args.event.stopPropagation(); // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
8433
8427
 
8434
8428
  if (chart.style.markLine.lock) {
8435
8429
  // 标线状态一直禁用系统能力
8436
8430
  // 如果指定了锁定值,只需要一项符合要求就进行锁定
8437
8431
  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) {
8438
8432
  lineTouching = 1;
8439
- args.event.preventDefault(); // 阻止默认行为
8433
+ args.event && args.event.preventDefault && args.event.preventDefault(); // 阻止默认行为
8440
8434
  }
8441
8435
  }
8442
8436
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmchart",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "chart",
5
5
  "main": "./index.js",
6
6
  "directories": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/jiamao/jmchart#readme",
30
30
  "dependencies": {
31
- "jmgraph": "^3.1.96"
31
+ "jmgraph": "^3.1.97"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/core": "^7.10.2",
@@ -107,7 +107,7 @@ export default class jmMarkLineManager {
107
107
  else lineTouching = 1;
108
108
  }
109
109
 
110
- args.event.stopPropagation && args.event.stopPropagation();
110
+ args.event && args.event.stopPropagation && args.event.stopPropagation();
111
111
  // 如果指定了锁定图表标线操作值,则触发后当次滑动不再响应系统默认行为
112
112
  if(chart.style.markLine.lock){
113
113
  // 标线状态一直禁用系统能力
@@ -118,7 +118,7 @@ export default class jmMarkLineManager {
118
118
  || lineTouching === 1) {
119
119
 
120
120
  lineTouching = 1;
121
- args.event.preventDefault(); // 阻止默认行为
121
+ args.event && args.event.preventDefault && args.event.preventDefault(); // 阻止默认行为
122
122
  }
123
123
  }
124
124