@js-draw/math 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/Color4.js +4 -0
- package/dist/mjs/Color4.mjs +4 -0
- package/package.json +2 -2
- package/src/Color4.ts +7 -1
package/dist/cjs/Color4.js
CHANGED
@@ -111,6 +111,10 @@ class Color4 {
|
|
111
111
|
canvas.width = 1;
|
112
112
|
canvas.height = 1;
|
113
113
|
const ctx = canvas.getContext('2d');
|
114
|
+
// Default to black if no canvas is available.
|
115
|
+
if (!ctx) {
|
116
|
+
return Color4.black;
|
117
|
+
}
|
114
118
|
ctx.fillStyle = text;
|
115
119
|
ctx.fillRect(0, 0, 1, 1);
|
116
120
|
const data = ctx.getImageData(0, 0, 1, 1);
|
package/dist/mjs/Color4.mjs
CHANGED
@@ -105,6 +105,10 @@ class Color4 {
|
|
105
105
|
canvas.width = 1;
|
106
106
|
canvas.height = 1;
|
107
107
|
const ctx = canvas.getContext('2d');
|
108
|
+
// Default to black if no canvas is available.
|
109
|
+
if (!ctx) {
|
110
|
+
return Color4.black;
|
111
|
+
}
|
108
112
|
ctx.fillStyle = text;
|
109
113
|
ctx.fillRect(0, 0, 1, 1);
|
110
114
|
const data = ctx.getImageData(0, 0, 1, 1);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@js-draw/math",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.2",
|
4
4
|
"description": "A math library for js-draw. ",
|
5
5
|
"types": "./dist/mjs/lib.d.ts",
|
6
6
|
"main": "./dist/cjs/lib.js",
|
@@ -45,5 +45,5 @@
|
|
45
45
|
"svg",
|
46
46
|
"math"
|
47
47
|
],
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "ced98ae289f299c44b54515571d0087aa6d32cdc"
|
49
49
|
}
|
package/src/Color4.ts
CHANGED
@@ -125,7 +125,13 @@ export default class Color4 {
|
|
125
125
|
canvas.width = 1;
|
126
126
|
canvas.height = 1;
|
127
127
|
|
128
|
-
const ctx = canvas.getContext('2d')
|
128
|
+
const ctx = canvas.getContext('2d');
|
129
|
+
|
130
|
+
// Default to black if no canvas is available.
|
131
|
+
if (!ctx) {
|
132
|
+
return Color4.black;
|
133
|
+
}
|
134
|
+
|
129
135
|
ctx.fillStyle = text;
|
130
136
|
ctx.fillRect(0, 0, 1, 1);
|
131
137
|
|