prevent switching to another sprite if a block editor is open

so local blocks of different sprites don't mix
pull/89/head
jmoenig 2019-10-15 08:22:21 +02:00
rodzic e5fd3d9f36
commit c0e3bbecca
3 zmienionych plików z 23 dodań i 5 usunięć

Wyświetl plik

@ -6,8 +6,9 @@
* accept a list of pixels in the SWITCH TO COSTUME block
* URLs in dialog boxes are now clickable and can open new browser tabs, thanks, Brian Broll!
* **Notable Changes:**
* **Notable Fixes:**
* made "i" upvar inside FOR loop's C-Shape slot mutable by user script
* prevent switching to another sprite if a block editor is open (so local blocks of different sprites don't mix)
* **Notable Fixes:**
* typing strings into the search-field again shows relevant blocks (regression from IME)
* fixed project dialog's search-field behevior (regression from IME)
* morphic collision detection off-by-1 fix, thanks, Dariusz!
@ -20,6 +21,9 @@
* Galician, thanks, Bernat
* Turkish, thanks, Turgut!
### 2019-10-15
* gui: prevent switching to another sprite if a block editor is open (so local blocks of different sprites don't mix)
### 2019-10-14
* morphic: new "reactToInput" text-editing event
* objects: fixed #2485 (find blocks and text-entry mode feature)

Wyświetl plik

@ -9,7 +9,7 @@
<script type="text/javascript" src="src/blocks.js?version=2019-08-07"></script>
<script type="text/javascript" src="src/threads.js?version=2019-10-14"></script>
<script type="text/javascript" src="src/objects.js?version=2019-10-14"></script>
<script type="text/javascript" src="src/gui.js?version=2019-10-14"></script>
<script type="text/javascript" src="src/gui.js?version=2019-10-15"></script>
<script type="text/javascript" src="src/paint.js?version=2019-06-27"></script>
<script type="text/javascript" src="src/lists.js?version=2019-07-01"></script>
<script type="text/javascript" src="src/byob.js?version=2019-07-24"></script>

Wyświetl plik

@ -60,7 +60,7 @@
/*global modules, Morph, SpriteMorph, SyntaxElementMorph, Color, Cloud,
ListWatcherMorph, TextMorph, newCanvas, useBlurredShadows, VariableFrame,
StringMorph, Point, MenuMorph, morphicVersion, DialogBoxMorph,normalizeCanvas,
StringMorph, Point, MenuMorph, morphicVersion, DialogBoxMorph, normalizeCanvas,
ToggleButtonMorph, contains, ScrollFrameMorph, StageMorph, PushButtonMorph, sb,
InputFieldMorph, FrameMorph, Process, nop, SnapSerializer, ListMorph, detect,
AlignmentMorph, TabMorph, Costume, MorphicPreferences, Sound, BlockMorph,
@ -71,11 +71,12 @@ CommentMorph, CommandBlockMorph, BooleanSlotMorph, RingReporterSlotMorph,
BlockLabelPlaceHolderMorph, Audio, SpeechBubbleMorph, ScriptFocusMorph,
XML_Element, WatcherMorph, BlockRemovalDialogMorph, saveAs, TableMorph,
isSnapObject, isRetinaEnabled, disableRetinaSupport, enableRetinaSupport,
isRetinaSupported, SliderMorph, Animation, BoxMorph, MediaRecorder*/
isRetinaSupported, SliderMorph, Animation, BoxMorph, MediaRecorder,
BlockEditorMorph, BlockDialogMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2019-October-14';
modules.gui = '2019-October-15';
// Declarations
@ -2151,6 +2152,19 @@ IDE_Morph.prototype.stopAllScripts = function () {
};
IDE_Morph.prototype.selectSprite = function (sprite) {
// prevent switching to another sprite if a block editor is open
// so local blocks of different sprites don't mix
if (
detect(
this.world().children,
function (morph) {
return morph instanceof BlockEditorMorph ||
morph instanceof BlockDialogMorph;
}
)
) {
return;
}
if (this.currentSprite && this.currentSprite.scripts.focus) {
this.currentSprite.scripts.focus.stopEditing();
}