Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
import { toPiuColorString } from 'face-state'
import { type Skin as PiuSkin, Skin } from 'piu/MC'
export const FULL_TURN = 2 * Math.PI
export {
quantizeUnit,
rememberCachedValue,
SHAPE_CACHE_ENTRY_LIMIT,
UNIT_OPEN_STEPS,
unitFromStep,
} from 'parts/shape-cache'
let fillSkinCache: Map<number, PiuSkin> | null = null
let strokeSkinCache: Map<number, PiuSkin> | null = null
let fillStrokeSkinCache: Map<number, PiuSkin> | null = null
export function getFillSkin(color: number): PiuSkin {
if (!fillSkinCache) fillSkinCache = new Map()
let skin = fillSkinCache.get(color)
if (skin) return skin
skin = new Skin({ fill: toPiuColorString(color) })
fillSkinCache.set(color, skin)
return skin
}
export function getStrokeSkin(color: number): PiuSkin {
if (!strokeSkinCache) strokeSkinCache = new Map()
let skin = strokeSkinCache.get(color)
if (skin) return skin
skin = new Skin({ stroke: toPiuColorString(color) })
strokeSkinCache.set(color, skin)
return skin
}
export function getFillStrokeSkin(color: number): PiuSkin {
if (!fillStrokeSkinCache) fillStrokeSkinCache = new Map()
let skin = fillStrokeSkinCache.get(color)
if (skin) return skin
const value = toPiuColorString(color)
skin = new Skin({ fill: value, stroke: value })
fillStrokeSkinCache.set(color, skin)
return skin
}
6c5dfa008This file is pinned to the selected release. Download the original to open it in your design tool.