embed blocks code into all custom block definition pics

snap8
Jens Mönig 2022-07-11 19:24:31 +02:00
rodzic 7a2c5fe05c
commit 864a3b62a0
3 zmienionych plików z 24 dodań i 9 usunięć

Wyświetl plik

@ -60,6 +60,8 @@
### 2022-07-11 ### 2022-07-11
* extensions: fixed #3065 * extensions: fixed #3065
* threads: added support to the OF reporter for binding a ring to another one, e.g. THIS SCRIPT to access its local variables * threads: added support to the OF reporter for binding a ring to another one, e.g. THIS SCRIPT to access its local variables
* byob: embed blocks code into all custom block definition pics
### 2022-07-04 ### 2022-07-04
* blocks, gui: directly import embedded blocks from a smart pic if the pic is dragged and dropped onto a scripting area or palette - otherwise import the pic as costume (with embedded blocks) * blocks, gui: directly import embedded blocks from a smart pic if the pic is dragged and dropped onto a scripting area or palette - otherwise import the pic as costume (with embedded blocks)
* gui: import smart pic as costume via "Import..." item in the project menu * gui: import smart pic as costume via "Import..." item in the project menu

Wyświetl plik

@ -23,7 +23,7 @@
<script src="src/gui.js?version=2022-07-04"></script> <script src="src/gui.js?version=2022-07-04"></script>
<script src="src/paint.js?version=2021-07-05"></script> <script src="src/paint.js?version=2021-07-05"></script>
<script src="src/lists.js?version=2022-05-19"></script> <script src="src/lists.js?version=2022-05-19"></script>
<script src="src/byob.js?version=2022-06-29"></script> <script src="src/byob.js?version=2022-07-11"></script>
<script src="src/tables.js?version=2022-01-28"></script> <script src="src/tables.js?version=2022-01-28"></script>
<script src="src/sketch.js?version=2021-11-03"></script> <script src="src/sketch.js?version=2021-11-03"></script>
<script src="src/video.js?version=2019-06-27"></script> <script src="src/video.js?version=2019-06-27"></script>

Wyświetl plik

@ -105,13 +105,13 @@ ToggleButtonMorph, IDE_Morph, MenuMorph, ToggleElementMorph, fontHeight, isNil,
StageMorph, SyntaxElementMorph, CommentMorph, localize, CSlotMorph, Variable, StageMorph, SyntaxElementMorph, CommentMorph, localize, CSlotMorph, Variable,
MorphicPreferences, SymbolMorph, CursorMorph, VariableFrame, BooleanSlotMorph, MorphicPreferences, SymbolMorph, CursorMorph, VariableFrame, BooleanSlotMorph,
WatcherMorph, XML_Serializer, SnapTranslator, SnapExtensions, MultiArgMorph, WatcherMorph, XML_Serializer, SnapTranslator, SnapExtensions, MultiArgMorph,
ArgLabelMorph*/ ArgLabelMorph, embedMetadataPNG*/
/*jshint esversion: 6*/ /*jshint esversion: 6*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.byob = '2022-June-29'; modules.byob = '2022-July-11';
// Declarations // Declarations
@ -1362,16 +1362,29 @@ CustomCommandBlockMorph.prototype.userMenu = function () {
if (this.isPrototype) { if (this.isPrototype) {
menu = new MenuMorph(this); menu = new MenuMorph(this);
menu.addItem( menu.addItem(
"script pic...", "script pic...", // +++
function () { function () {
var ide = this.world().children[0]; var ide = this.world().children[0],
ide.saveCanvasAs( top = this.topBlock(),
this.topBlock().scriptPic(), xml = ide.blocksLibraryXML(
(ide.projectName || localize('untitled')) + ' ' + [top.definition].concat(
top.definition.collectDependencies(
[],
[],
top.scriptTarget()
)
),
null,
true
);
ide.saveFileAs(
embedMetadataPNG(top.scriptPic(), xml),
'image/png',
(ide.getProjectName() || localize('untitled')) + ' ' +
localize('script pic') localize('script pic')
); );
}, },
'open a new window\nwith a picture of this script' 'save a picture\nof this script'
); );
menu.addItem( menu.addItem(
"translations...", "translations...",