jmgraph 3.1.92 → 3.1.93

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
  }