- Joined
- Sep 25, 2014
- Messages
- 138
- Reaction score
- 20
- Primarily Uses
@Felski
Hope you are doing well.
I've implemented your wordwrap code change and unfortunately it seems like nothing has changed. Below is a screenshot regarding what I'm talking about more specifically, just in case it was not initially clear.
https://i.imgur.com/2xTUcPg.png
This is the final lines of the code in your .JS with the change (as the wordwrap function seems to take place at the very end, this is the most convenient way to show you what I have done).
Let me know if I've simply messed something up. Thanks again.
Hope you are doing well.
I've implemented your wordwrap code change and unfortunately it seems like nothing has changed. Below is a screenshot regarding what I'm talking about more specifically, just in case it was not initially clear.
https://i.imgur.com/2xTUcPg.png
This is the final lines of the code in your .JS with the change (as the wordwrap function seems to take place at the very end, this is the most convenient way to show you what I have done).
Code:
//************************************************************************************************
//
// Utility Stuff
//
//************************************************************************************************
Window_Base.prototype.drawTextAutoWrap = function (text, x, y, maxWidth) {
if (!text) {
return 0;
}
const words = text.split(' ');
let lines = 1;
let x2 = x;
let y2 = y;
words.forEach((word) => {
word = this.convertEscapeCharacters(word);
const width = this.textWidth(word + ' ');
// Check for linebreak symbol '/n'
if (word === `\x1bn`) {
lines++;
y2 += this.lineHeight();
x2 = 0;
}
if (x2 + width >= maxWidth) {
lines++;
y2 += this.lineHeight();
x2 = 0;
}
this.drawText(word + ' ', x+x2, y2);
x2 += width;
});
return lines;
};
function jsonCopy(src) { //Credits and thanks to Farzad YZ on medium.com
return JSON.parse(JSON.stringify(src));
}
})();