support exporting costumes from result bubbles

snap7
Jens Mönig 2022-01-28 09:29:54 +01:00
rodzic a36f1e02c0
commit a45f8ce9e0
2 zmienionych plików z 26 dodań i 2 usunięć

Wyświetl plik

@ -4,6 +4,7 @@
* **New Features:**
* support dragging blocks, costumes and sounds out from result bubbles, and from speech balloons and variable watchers when in edit mode
* support exporting costumes from result bubbles
* support deleting and inserting individual variadic slots, script vars & ring params
* **Notable Changes:**
* **Notable Fixes:**
@ -16,6 +17,7 @@
### 2022-01-28
* tables: support dragging costumes and sounds out from table views
* blocks: support exporting costumes from result bubbles
### 2022-01-27
* blocks, gui: support dragging costumes and sounds out from result bubbles

Wyświetl plik

@ -155,13 +155,13 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, WHITE, BLACK,
Costume, IDE_Morph, BlockDialogMorph, BlockEditorMorph, localize, CLEAR, Point,
isSnapObject, PushButtonMorph, SpriteIconMorph, Process, AlignmentMorph, List,
CustomCommandBlockMorph, ToggleButtonMorph, DialMorph, SnapExtensions,
CostumeIconMorph, SoundIconMorph*/
CostumeIconMorph, SoundIconMorph, SVG_Costume*/
/*jshint esversion: 6*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2022-January-27';
modules.blocks = '2022-January-28';
var SyntaxElementMorph;
var BlockMorph;
@ -2275,6 +2275,28 @@ SyntaxElementMorph.prototype.showBubble = function (value, exportPic, target) {
icon.setCenter(this.center());
return icon;
};
// support exporting costumes directly from result bubbles
morphToShow.userMenu = function () {
var menu = new MenuMorph(this);
menu.addItem(
'export',
() => {
if (value instanceof SVG_Costume) {
// don't show SVG costumes in a new tab (shows text)
ide.saveFileAs(
value.contents.src,
'text/svg',
value.name
);
} else { // rasterized Costume
ide.saveCanvasAs(value.contents, value.name);
}
}
);
return menu;
};
} else if (value instanceof Sound) {
morphToShow = new SymbolMorph('notes', 30);