MCPcopy Index your code
hub / github.com/phaserjs/phaser / makeSrc

Function makeSrc

tests/gameobjects/bitmaptext/GetBitmapTextSize.test.js:17–48  ·  view source on GitHub ↗
(text, options)

Source from the content-addressed store, hash-verified

15
16// Helper to create a basic src mock with sensible defaults
17function makeSrc (text, options)
18{
19 options = options || {};
20
21 var fontDataSize = options.fontDataSize !== undefined ? options.fontDataSize : 16;
22 var lineHeight = options.lineHeight !== undefined ? options.lineHeight : 16;
23 var fontSize = options.fontSize !== undefined ? options.fontSize : 16;
24 var chars = options.chars || {};
25
26 return {
27 text: text,
28 maxWidth: options.maxWidth !== undefined ? options.maxWidth : 0,
29 wordWrapCharCode: options.wordWrapCharCode !== undefined ? options.wordWrapCharCode : 32,
30 fontData: {
31 chars: chars,
32 lineHeight: lineHeight,
33 size: fontDataSize
34 },
35 letterSpacing: options.letterSpacing !== undefined ? options.letterSpacing : 0,
36 lineSpacing: options.lineSpacing !== undefined ? options.lineSpacing : 0,
37 fontSize: fontSize,
38 scaleX: options.scaleX !== undefined ? options.scaleX : 1,
39 scaleY: options.scaleY !== undefined ? options.scaleY : 1,
40 _align: options._align !== undefined ? options._align : 0,
41 x: options.x !== undefined ? options.x : 0,
42 y: options.y !== undefined ? options.y : 0,
43 _displayOriginX: options._displayOriginX !== undefined ? options._displayOriginX : 0,
44 _displayOriginY: options._displayOriginY !== undefined ? options._displayOriginY : 0,
45 originX: options.originX !== undefined ? options.originX : 0,
46 originY: options.originY !== undefined ? options.originY : 0
47 };
48}
49
50// Helper to create a structured out object matching the default shape
51function makeOut ()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…