0.1.12
This commit is contained in:
@ -57,19 +57,19 @@ export const scoreText = new TextStyle({
|
||||
function getStyle(styleOptions: TextStyleOptions = {}) {
|
||||
const {
|
||||
fill = 0xa2a2a2,
|
||||
stroke = 0x565656,
|
||||
fontSize = 15,
|
||||
fontFamily = 'Arial, Helvetica, sans-serif',
|
||||
fontWeight = 'normal',
|
||||
fontStyle = 'normal',
|
||||
dropShadow,
|
||||
letterSpacing = 1,
|
||||
stroke,
|
||||
} = styleOptions
|
||||
const style = new TextStyle({
|
||||
fill,
|
||||
fontFamily,
|
||||
letterSpacing,
|
||||
stroke,
|
||||
stroke: stroke ? stroke : undefined,
|
||||
fontSize,
|
||||
fontStyle,
|
||||
fontWeight: fontWeight as any,
|
||||
@ -78,6 +78,20 @@ function getStyle(styleOptions: TextStyleOptions = {}) {
|
||||
return style
|
||||
}
|
||||
|
||||
const styleFactory = (fill: number) => {
|
||||
return (
|
||||
fontSize: number = 15,
|
||||
fontWeight: TextStyleFontWeight = 'normal',
|
||||
dropShadow: boolean = false,
|
||||
) =>
|
||||
getStyle({
|
||||
fill,
|
||||
fontSize,
|
||||
fontWeight,
|
||||
dropShadow,
|
||||
})
|
||||
}
|
||||
|
||||
export const whiteStyle = (
|
||||
fontSize: number = 15,
|
||||
fontWeight: TextStyleFontWeight = 'normal',
|
||||
@ -101,6 +115,8 @@ export const yellowStyle = (
|
||||
dropShadow,
|
||||
})
|
||||
|
||||
export const grayStyle = styleFactory(0x444444)
|
||||
|
||||
interface TextOptions {
|
||||
text: string
|
||||
x: number
|
||||
|
Reference in New Issue
Block a user