mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-09-08 15:40:42 +02:00
fix for older ES6 browsers without ?? operator
This commit is contained in:
@@ -125,7 +125,7 @@ class GraphicsAPI extends BaseAPI {
|
|||||||
* transforms: scale
|
* transforms: scale
|
||||||
*/
|
*/
|
||||||
scale(x, y) {
|
scale(x, y) {
|
||||||
y = y ?? x;
|
y = y ? y : x; // NOTE: this turns y=0 into y=x, which is fine. Scaling by 0 is really silly =)
|
||||||
this.ctx.scale(x, y);
|
this.ctx.scale(x, y);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@@ -16,8 +16,8 @@ class Vector {
|
|||||||
let sum = 0;
|
let sum = 0;
|
||||||
sum += (this.x - other.x) ** 2;
|
sum += (this.x - other.x) ** 2;
|
||||||
sum += (this.y - other.y) ** 2;
|
sum += (this.y - other.y) ** 2;
|
||||||
let z1 = this.z ?? 0;
|
let z1 = this.z ? this.z : 0;
|
||||||
let z2 = other.z ?? 0;
|
let z2 = other.z ? other.z : 0;
|
||||||
sum += (z1 - z2) ** 2;
|
sum += (z1 - z2) ** 2;
|
||||||
return sum ** 0.5;
|
return sum ** 0.5;
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,7 @@ class LocaleStrings {
|
|||||||
Object.keys(localeStringData).forEach((id) => {
|
Object.keys(localeStringData).forEach((id) => {
|
||||||
const map = localeStringData[id];
|
const map = localeStringData[id];
|
||||||
if (typeof map !== "object") return;
|
if (typeof map !== "object") return;
|
||||||
const value = map[locale] ?? map[defaultLocale];
|
const value = map[locale] ? map[locale] : map[defaultLocale];
|
||||||
if (!value) throw new Error(`unknown locale string id "${id}".`);
|
if (!value) throw new Error(`unknown locale string id "${id}".`);
|
||||||
strings[id] = value;
|
strings[id] = value;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user