Changeset View
Changeset View
Standalone View
Standalone View
web/utils/text-utils.js
// @flow | // @flow | ||||
import invariant from 'invariant'; | import invariant from 'invariant'; | ||||
import type { Crypto } from '../database/utils/crypto-types.js'; | |||||
let canvas; | let canvas; | ||||
declare var crypto: { | declare var crypto: Crypto; | ||||
getRandomValues<NumArray: $TypedArray>(typedArray: NumArray): NumArray, | |||||
... | |||||
}; | |||||
function calculateMaxTextWidth( | function calculateMaxTextWidth( | ||||
texts: $ReadOnlyArray<string>, | texts: $ReadOnlyArray<string>, | ||||
font: string, | font: string, | ||||
): number { | ): number { | ||||
if (!canvas) { | if (!canvas) { | ||||
canvas = document.createElement('canvas'); | canvas = document.createElement('canvas'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |