@millistream/millistream-widgets 1.0.15 → 1.0.16

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.
@@ -6,10 +6,10 @@
6
6
 
7
7
 
8
8
 
9
- (function(prototype) {
9
+ (function(prototype) {
10
10
 
11
11
  var pixelRatio = (function() {
12
- var canvas = document.createElement('canvas'),
12
+ var canvas = document.createElement('canvas'),
13
13
  context = canvas.getContext('2d');
14
14
 
15
15
 
@@ -20,7 +20,6 @@
20
20
 
21
21
 
22
22
  })(),
23
-
24
23
  forEach = function(obj, func) {
25
24
  for (var p in obj) {
26
25
  if (obj.hasOwnProperty(p)) {
@@ -49,14 +48,19 @@
49
48
 
50
49
  if (pixelRatio === 1) return;
51
50
 
52
- function getPixelRatio() {
53
- var backingStore = this.backingStorePixelRatio ||
54
- this.webkitBackingStorePixelRatio ||
55
- this.mozBackingStorePixelRatio ||
56
- this.msBackingStorePixelRatio ||
57
- this.oBackingStorePixelRatio ||
58
- this.backingStorePixelRatio || 1;
59
-
51
+ function getPixelRatio(_this) {
52
+
53
+
54
+
55
+
56
+
57
+
58
+ var backingStore = _this.backingStorePixelRatio ||
59
+ _this.webkitBackingStorePixelRatio ||
60
+ _this.mozBackingStorePixelRatio ||
61
+ _this.msBackingStorePixelRatio ||
62
+ _this.oBackingStorePixelRatio ||
63
+ _this.backingStorePixelRatio || 1;
60
64
  return (window.devicePixelRatio || 1) / backingStore;
61
65
 
62
66
  };
@@ -73,11 +77,11 @@
73
77
  } else
74
78
  if (value === 'all') {
75
79
  args = args.map(function(a) {
76
- return a * this.getPixelRatio();
80
+ return a * getPixelRatio(this);
77
81
  });
78
82
  } else if (Array.isArray(value)) {
79
83
  for (i = 0, len = value.length; i < len; i++) {
80
- args[value[i]] *= this.getPixelRatio();
84
+ args[value[i]] *= getPixelRatio(this);
81
85
  }
82
86
  }
83
87
 
@@ -89,9 +93,9 @@
89
93
 
90
94
  prototype.stroke = (function(_super) {
91
95
  return function() {
92
- this.lineWidth *= _super.getPixelRatio();
96
+ this.lineWidth *= getPixelRatio(this);
93
97
  _super.apply(this, arguments);
94
- this.lineWidth /= _super.getPixelRatio();
98
+ this.lineWidth /= getPixelRatio(this);
95
99
  };
96
100
  })(prototype.stroke);
97
101
 
@@ -100,10 +104,11 @@
100
104
  var args = Array.prototype.slice.call(arguments);
101
105
 
102
106
  var tmp = this.font;
107
+ var _this = this;
103
108
  this.font = this.font.replace(
104
109
  /(\d+)(px|em|rem|pt)/g,
105
110
  function(w, m, u) {
106
- return Math.floor(m * 1) + u;
111
+ return Math.floor(m * getPixelRatio(_this)) + u;
107
112
  }
108
113
  );
109
114
  var i = _super.apply(this, args);
@@ -124,10 +129,11 @@
124
129
  return function() {
125
130
  var args = Array.prototype.slice.call(arguments);
126
131
  var tmp = this.font;
132
+ var _this = this;
127
133
  this.font = this.font.replace(
128
134
  /(\d+)(px|em|rem|pt)/g,
129
135
  function(w, m, u) {
130
- return (m * 1) + u;
136
+ return (m * getPixelRatio(_this)) + u;
131
137
  }
132
138
  );
133
139
  _super.apply(this, args);
@@ -139,13 +145,14 @@
139
145
  return function() {
140
146
  var args = Array.prototype.slice.call(arguments);
141
147
 
142
- args[1] *= this.getPixelRatio();
143
- args[2] *= this.getPixelRatio();
148
+ args[1] *= getPixelRatio(this);
149
+ args[2] *= getPixelRatio(this);
144
150
  var tmp = this.font;
151
+ var _this = this;
145
152
  this.font = this.font.replace(
146
153
  /(\d+)(px|em|rem|pt)/g,
147
154
  function(w, m, u) {
148
- return (m * 1) + u;
155
+ return (m * getPixelRatio(_this)) + u;
149
156
  }
150
157
  );
151
158
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@millistream/millistream-widgets",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Millistream widgets node package",
5
5
  "main": "millistream-widgets.js",
6
6
  "scripts": {