MCPcopy Create free account
hub / github.com/eva-engine/eva.js / constructor

Method constructor

packages/renderer-adapter/lib/BitmapText.ts:5–52  ·  view source on GitHub ↗
(text: string, style?: TextStyleOptions)

Source from the content-addressed store, hash-verified

3
4export default class BitmapText extends PIXIBitmapText {
5 constructor(text: string, style?: TextStyleOptions) {
6 const processedStyle = { ...style };
7
8 // @ts-ignore
9 if (processedStyle.strokeThickness) {
10 const color = processedStyle.stroke;
11 // @ts-ignore
12 processedStyle.stroke = {
13 color,
14 // @ts-ignore
15 width: processedStyle.strokeThickness,
16 };
17 delete processedStyle['strokeThickness'];
18 }
19
20 // dropShadow* -> dropShadow: { color, distance, angle, alpha, blur }
21 // @ts-ignore
22 if (processedStyle.dropShadow) {
23 const dropShadowConfig: Record<string, any> = {};
24 // @ts-ignore
25 if (processedStyle.dropShadowColor != null) dropShadowConfig.color = processedStyle.dropShadowColor;
26 // @ts-ignore
27 if (processedStyle.dropShadowDistance != null) dropShadowConfig.distance = processedStyle.dropShadowDistance;
28 // @ts-ignore
29 if (processedStyle.dropShadowAngle != null) dropShadowConfig.angle = processedStyle.dropShadowAngle;
30 // @ts-ignore
31 if (processedStyle.dropShadowAlpha != null) dropShadowConfig.alpha = processedStyle.dropShadowAlpha;
32 // @ts-ignore
33 if (processedStyle.dropShadowBlur != null) dropShadowConfig.blur = processedStyle.dropShadowBlur;
34 // @ts-ignore
35 processedStyle.dropShadow = dropShadowConfig;
36 delete processedStyle['dropShadowColor'];
37 delete processedStyle['dropShadowDistance'];
38 delete processedStyle['dropShadowAngle'];
39 delete processedStyle['dropShadowAlpha'];
40 delete processedStyle['dropShadowBlur'];
41 }
42
43 if (Array.isArray(processedStyle.fill)) {
44 console.warn('Eva.js Deprecation Warning: fill array is not supported in Eva.js v2.');
45 processedStyle.fill = processedStyle.fill[0];
46 }
47
48 super({
49 text,
50 style: processedStyle,
51 });
52 }
53}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected