diff --git a/lib/custom-element/api/graphics-api.js b/lib/custom-element/api/graphics-api.js index fff201a1..d065782c 100644 --- a/lib/custom-element/api/graphics-api.js +++ b/lib/custom-element/api/graphics-api.js @@ -125,7 +125,7 @@ class GraphicsAPI extends BaseAPI { * transforms: scale */ 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); } /** diff --git a/lib/custom-element/api/types/vector.js b/lib/custom-element/api/types/vector.js index c67832ca..8a9639a1 100644 --- a/lib/custom-element/api/types/vector.js +++ b/lib/custom-element/api/types/vector.js @@ -16,8 +16,8 @@ class Vector { let sum = 0; sum += (this.x - other.x) ** 2; sum += (this.y - other.y) ** 2; - let z1 = this.z ?? 0; - let z2 = other.z ?? 0; + let z1 = this.z ? this.z : 0; + let z2 = other.z ? other.z : 0; sum += (z1 - z2) ** 2; return sum ** 0.5; } diff --git a/tools/locale-strings.js b/tools/locale-strings.js index 67d5f687..c9e926b8 100644 --- a/tools/locale-strings.js +++ b/tools/locale-strings.js @@ -54,7 +54,7 @@ class LocaleStrings { Object.keys(localeStringData).forEach((id) => { const map = localeStringData[id]; 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}".`); strings[id] = value;