* @param {number} x - position of the text object * @param {number} y - position of the text object * @param {object} settings - the text configuration * @param {string} settings.font - a CSS family font name * @param {number|string} settings.size - size, or size + suffix (px, em, pt) * @p
(x, y, settings)
| 41 | * let font = new Text(0, 0, {font: "Arial", size: 8, fillStyle: this.color}); |
| 42 | */ |
| 43 | constructor(x, y, settings) { |
| 44 | // call the parent constructor |
| 45 | super(x, y, settings.width || 0, settings.height || 0); |
| 46 | |
| 47 | /** |
| 48 | * defines the color used to draw the font. |
| 49 | * @type {Color} |
| 50 | * @default black |
| 51 | */ |
| 52 | this.fillStyle = colorPool.get(0, 0, 0); |
| 53 | |
| 54 | /** |
| 55 | * defines the color used to draw the font stroke.<br> |
| 56 | * @type {Color} |
| 57 | * @default black |
| 58 | */ |
| 59 | this.strokeStyle = colorPool.get(0, 0, 0); |
| 60 | |
| 61 | /** |
| 62 | * sets the current line width, in pixels, when drawing stroke |
| 63 | * @type {number} |
| 64 | * @default 0 |
| 65 | */ |
| 66 | this.lineWidth = 0; |
| 67 | |
| 68 | /** |
| 69 | * Set the default text alignment (or justification),<br> |
| 70 | * possible values are "left", "right", and "center".<br> |
| 71 | * @type {string} |
| 72 | * @default "left" |
| 73 | */ |
| 74 | this.textAlign = "left"; |
| 75 | |
| 76 | /** |
| 77 | * Set the text baseline (e.g. the Y-coordinate for the draw operation), <br> |
| 78 | * possible values are "top", "hanging", "middle", "alphabetic", "ideographic", "bottom"<br> |
| 79 | * @type {string} |
| 80 | * @default "top" |
| 81 | */ |
| 82 | this.textBaseline = "top"; |
| 83 | |
| 84 | /** |
| 85 | * Set the line spacing height (when displaying multi-line strings). <br> |
| 86 | * Current font height will be multiplied with this value to set the line height. |
| 87 | * @type {number} |
| 88 | * @default 1.0 |
| 89 | */ |
| 90 | this.lineHeight = 1.0; |
| 91 | |
| 92 | /** |
| 93 | * the maximum length in CSS pixel for a single segment of text. |
| 94 | * (use -1 to disable word wrapping) |
| 95 | * @type {number} |
| 96 | * @default -1 |
| 97 | */ |
| 98 | this.wordWrapWidth = -1; |
| 99 | |
| 100 | /** |
nothing calls this directly
no test coverage detected