jmgraph 3.1.92 → 3.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.
@@ -69,7 +69,7 @@ export default class jmGraph extends jmControl {
69
69
  }
70
70
  }
71
71
  this.canvas = canvas;
72
- if(!this.context) this.context = canvas.getContext('2d');
72
+ this.context = canvas.getContext('2d');
73
73
  this.__init(callback);
74
74
  }
75
75
 
@@ -124,24 +124,18 @@ export default class jmGraph extends jmControl {
124
124
  if(this.isWXMiniApp) {
125
125
  scale = wx.getSystemInfoSync().pixelRatio || 1;
126
126
  }
127
- if (scale > 1) {
127
+ else if (scale > 1) {
128
128
  this.__normalSize = this.__normalSize || { width: 0, height: 0};
129
129
  w = w || this.__normalSize.width || this.width, h = h || this.__normalSize.height || this.height;
130
130
 
131
131
  if(w) this.__normalSize.width = w;
132
132
  if(h) this.__normalSize.height = h;
133
133
 
134
- if(this.canvas.style) {
135
- this.canvas.style.width = w + "px";
136
- this.canvas.style.height = h + "px";
137
- this.canvas.height = h * scale;
138
- this.canvas.width = w *scale;
139
- this.context.scale(scale, scale);
140
- }
141
- else {
142
- this.canvas.height = h;
143
- this.canvas.width = w;
144
- }
134
+ this.canvas.style && (this.canvas.style.width = w + "px");
135
+ this.canvas.style && (this.canvas.style.height = h + "px");
136
+ this.canvas.height = h * scale;
137
+ this.canvas.width = w *scale;
138
+ this.context.scale(scale, scale);
145
139
  this.devicePixelRatio = scale;
146
140
  }
147
141
  }
@@ -505,7 +499,7 @@ export default class jmGraph extends jmControl {
505
499
  this.___isAutoRefreshing = true;
506
500
 
507
501
  function update() {
508
- if(self.destoryed) {
502
+ if(self.destroyed) {
509
503
  self.___isAutoRefreshing = false;
510
504
  return;// 已销毁
511
505
  }
@@ -520,9 +514,9 @@ export default class jmGraph extends jmControl {
520
514
  }
521
515
 
522
516
  // 销毁当前对象
523
- destory() {
524
- this.eventHandler.destory();
525
- this.destoryed = true;// 标记已销毁
517
+ destroy() {
518
+ this.eventHandler.destroy();
519
+ this.destroyed = true;// 标记已销毁
526
520
  }
527
521
  }
528
522