-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added optional color-csv parameter to flashScripts() api
- Loading branch information
Showing
6 changed files
with
30 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
written by Jens Mönig | ||
[email protected] | ||
Copyright (C) 2023 by Jens Mönig | ||
Copyright (C) 2024 by Jens Mönig | ||
This file is part of Snap!. | ||
|
@@ -46,7 +46,7 @@ detect, isSnapObject, VariableFrame*/ | |
|
||
// Global stuff //////////////////////////////////////////////////////// | ||
|
||
modules.api = '2023-January-30'; | ||
modules.api = '2024-January-22'; | ||
|
||
// IDE_Morph external communication API | ||
/* | ||
|
@@ -278,14 +278,17 @@ IDE_Morph.prototype.loadSpriteScriptsXML = function (scriptsXML) { | |
return this.spriteNamed(name).synchScriptsFrom(scriptsXML); | ||
}; | ||
|
||
IDE_Morph.prototype.flashSpriteScripts = function (fromLOC, toLOC, name) { | ||
IDE_Morph.prototype.flashSpriteScripts = function (fromLOC, toLOC, name, clr) { | ||
// highlight the blocks of the scripts of the sprite indicated by name or | ||
// the current sprite or stage if none that correspond to the portion of the | ||
// text between the start- and end lines when using the current codification | ||
// mapping | ||
// mapping. | ||
// Optionally a string of comma-separated "r,g,b[a]" values can be passed | ||
// in to specify a specific highlight color. Of none is supplied the default | ||
// flash color is used. | ||
var scripts = this.spriteNamed(name).scripts; | ||
scripts.unflash(); | ||
scripts.flashLOC(fromLOC, toLOC); | ||
scripts.flashLOC(fromLOC, toLOC, clr); | ||
}; | ||
|
||
IDE_Morph.prototype.unflashSpriteScripts = function (name) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
written by Jens Mönig | ||
[email protected] | ||
Copyright (C) 2023 by Jens Mönig | ||
Copyright (C) 2024 by Jens Mönig | ||
This file is part of Snap!. | ||
|
@@ -161,7 +161,7 @@ SVG_Costume, embedMetadataPNG, ThreadManager, snapEquals*/ | |
|
||
// Global stuff //////////////////////////////////////////////////////// | ||
|
||
modules.blocks = '2023-November-24'; | ||
modules.blocks = '2024-January-22'; | ||
|
||
var SyntaxElementMorph; | ||
var BlockMorph; | ||
|
@@ -9216,14 +9216,17 @@ ScriptsMorph.prototype.elementsAtLOC = function () { | |
return loc; | ||
}; | ||
|
||
ScriptsMorph.prototype.flashLOC = function (start, end = start) { | ||
ScriptsMorph.prototype.flashLOC = function (start, end = start, color = null) { | ||
// highlight all syntax elements located in the textual code indicated | ||
// by start and end line numbers. End is optional. | ||
// by start and end line numbers. End is optional, as is a color string of | ||
// the form "r,g,b[,a]". | ||
var loc = this.elementsAtLOC(), | ||
clr = color ? Color.fromString(color) : null, | ||
flash = (idx) => loc[idx - 1].forEach(elem => elem.flash(clr)), | ||
i; | ||
this.unflash(); | ||
for (i = start; i <= end; i += 1) { | ||
loc[i - 1].forEach(elem => elem.flash()); | ||
flash(i); | ||
} | ||
}; | ||
|
||
|