@millistream/millistream-widgets 1.0.15 → 1.0.17

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,16 +48,22 @@
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
-
60
- return (window.devicePixelRatio || 1) / backingStore;
51
+ function getPixelRatio(_this) {
61
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;
64
+ return (window.devicePixelRatio || 1) / backingStore;
65
+ */
66
+ return 1;
62
67
  };
63
68
 
64
69
  forEach(ratioArgs, function(value, key) {
@@ -73,11 +78,11 @@
73
78
  } else
74
79
  if (value === 'all') {
75
80
  args = args.map(function(a) {
76
- return a * this.getPixelRatio();
81
+ return a * getPixelRatio(this);
77
82
  });
78
83
  } else if (Array.isArray(value)) {
79
84
  for (i = 0, len = value.length; i < len; i++) {
80
- args[value[i]] *= this.getPixelRatio();
85
+ args[value[i]] *= getPixelRatio(this);
81
86
  }
82
87
  }
83
88
 
@@ -89,9 +94,9 @@
89
94
 
90
95
  prototype.stroke = (function(_super) {
91
96
  return function() {
92
- this.lineWidth *= _super.getPixelRatio();
97
+ this.lineWidth *= getPixelRatio(this);
93
98
  _super.apply(this, arguments);
94
- this.lineWidth /= _super.getPixelRatio();
99
+ this.lineWidth /= getPixelRatio(this);
95
100
  };
96
101
  })(prototype.stroke);
97
102
 
@@ -100,10 +105,11 @@
100
105
  var args = Array.prototype.slice.call(arguments);
101
106
 
102
107
  var tmp = this.font;
108
+ var _this = this;
103
109
  this.font = this.font.replace(
104
110
  /(\d+)(px|em|rem|pt)/g,
105
111
  function(w, m, u) {
106
- return Math.floor(m * 1) + u;
112
+ return Math.floor(m * getPixelRatio(_this)) + u;
107
113
  }
108
114
  );
109
115
  var i = _super.apply(this, args);
@@ -124,10 +130,11 @@
124
130
  return function() {
125
131
  var args = Array.prototype.slice.call(arguments);
126
132
  var tmp = this.font;
133
+ var _this = this;
127
134
  this.font = this.font.replace(
128
135
  /(\d+)(px|em|rem|pt)/g,
129
136
  function(w, m, u) {
130
- return (m * 1) + u;
137
+ return (m * getPixelRatio(_this)) + u;
131
138
  }
132
139
  );
133
140
  _super.apply(this, args);
@@ -139,13 +146,14 @@
139
146
  return function() {
140
147
  var args = Array.prototype.slice.call(arguments);
141
148
 
142
- args[1] *= this.getPixelRatio();
143
- args[2] *= this.getPixelRatio();
149
+ args[1] *= getPixelRatio(this);
150
+ args[2] *= getPixelRatio(this);
144
151
  var tmp = this.font;
152
+ var _this = this;
145
153
  this.font = this.font.replace(
146
154
  /(\d+)(px|em|rem|pt)/g,
147
155
  function(w, m, u) {
148
- return (m * 1) + u;
156
+ return (m * getPixelRatio(_this)) + u;
149
157
  }
150
158
  );
151
159
 
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.17",
4
4
  "description": "Millistream widgets node package",
5
5
  "main": "millistream-widgets.js",
6
6
  "scripts": {