|  | @@ -324,6 +324,13 @@ export const getTextHeight = (text: string, font: FontString) => {
 | 
											
												
													
														|  |  };
 |  |  };
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  export const wrapText = (text: string, font: FontString, maxWidth: number) => {
 |  |  export const wrapText = (text: string, font: FontString, maxWidth: number) => {
 | 
											
												
													
														|  | 
 |  | +  // if maxWidth is not finite or NaN which can happen in case of bugs in
 | 
											
												
													
														|  | 
 |  | +  // computation, we need to make sure we don't continue as we'll end up
 | 
											
												
													
														|  | 
 |  | +  // in an infinite loop
 | 
											
												
													
														|  | 
 |  | +  if (!Number.isFinite(maxWidth) || maxWidth < 0) {
 | 
											
												
													
														|  | 
 |  | +    return text;
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |    const lines: Array<string> = [];
 |  |    const lines: Array<string> = [];
 | 
											
												
													
														|  |    const originalLines = text.split("\n");
 |  |    const originalLines = text.split("\n");
 | 
											
												
													
														|  |    const spaceWidth = getLineWidth(" ", font);
 |  |    const spaceWidth = getLineWidth(" ", font);
 |