Merge pull request #1585 from apple502j/patch-1

Bubble string length limit
This commit is contained in:
Andrew Sliwinski 2018-10-04 14:29:38 -04:00 committed by GitHub
commit 492695112f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,6 +58,14 @@ class Scratch3LooksBlocks {
return 'Scratch.looks';
}
/**
* Limit for say bubble string.
* @const {string}
*/
static get SAY_BUBBLE_LIMIT () {
return 330;
}
/**
* @param {Target} target - collect bubble state for this target. Probably, but not necessarily, a RenderedTarget.
* @returns {BubbleState} the mutable bubble state associated with that target. This will be created if necessary.
@ -278,7 +286,7 @@ class Scratch3LooksBlocks {
if (typeof message === 'number') {
message = parseFloat(message.toFixed(2));
}
message = String(message);
message = String(message).substr(0, Scratch3LooksBlocks.SAY_BUBBLE_LIMIT);
this.runtime.emit('SAY', util.target, 'say', message);
}
@ -299,7 +307,7 @@ class Scratch3LooksBlocks {
}
think (args, util) {
this._updateBubble(util.target, 'think', String(args.MESSAGE));
this._updateBubble(util.target, 'think', String(args.MESSAGE).substr(0, Scratch3LooksBlocks.SAY_BUBBLE_LIMIT));
}
thinkforsecs (args, util) {