mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Merge pull request #1585 from apple502j/patch-1
Bubble string length limit
This commit is contained in:
commit
492695112f
1 changed files with 10 additions and 2 deletions
|
@ -58,6 +58,14 @@ class Scratch3LooksBlocks {
|
||||||
return 'Scratch.looks';
|
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.
|
* @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.
|
* @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') {
|
if (typeof message === 'number') {
|
||||||
message = parseFloat(message.toFixed(2));
|
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);
|
this.runtime.emit('SAY', util.target, 'say', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +307,7 @@ class Scratch3LooksBlocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
think (args, util) {
|
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) {
|
thinkforsecs (args, util) {
|
||||||
|
|
Loading…
Reference in a new issue