allow block-instances to be dragged off from templates in the "export blocks" dialog

snap7
jmoenig 2021-11-09 17:39:32 +01:00
rodzic 3d13ee0668
commit a85ea32b25
5 zmienionych plików z 20 dodań i 12 usunięć

Wyświetl plik

@ -24,6 +24,7 @@
* migrated SEND blocks to be BROADCAST TO blocks * migrated SEND blocks to be BROADCAST TO blocks
* "when I receive 'any message'" hat scripts are threadsafe (uninterruptable by other messages) * "when I receive 'any message'" hat scripts are threadsafe (uninterruptable by other messages)
* changed the color model for pen/background colors from HSV to HSL * changed the color model for pen/background colors from HSV to HSL
* allow block-instances to be dragged off from templates in the "export blocks" and "hide blocks" dialogs
* new Birdbrain Technology extensions for Finch and Hummingbird, thanks, Kristina and Bambi! * new Birdbrain Technology extensions for Finch and Hummingbird, thanks, Kristina and Bambi!
* retired Leap Motion library * retired Leap Motion library
* display blocks with their error messages for custom blocks, thanks, Michael! * display blocks with their error messages for custom blocks, thanks, Michael!
@ -56,6 +57,7 @@
* gui: adjusted random color for new sprites to HSL model * gui: adjusted random color for new sprites to HSL model
* objects: fixed keyboard entry for script variable getters * objects: fixed keyboard entry for script variable getters
* gui: changed edit project notes to always edit project motes instead of scene notes * gui: changed edit project notes to always edit project motes instead of scene notes
* byob, blocks, gui: allow block-instances to be dragged off from templates in the "export blocks" dialog
### 2021-11-08 ### 2021-11-08
* objects: renamed some internal color methods * objects: renamed some internal color methods

Wyświetl plik

@ -16,14 +16,14 @@
<script src="src/morphic.js?version=2021-07-09"></script> <script src="src/morphic.js?version=2021-07-09"></script>
<script src="src/symbols.js?version=2021-03-03"></script> <script src="src/symbols.js?version=2021-03-03"></script>
<script src="src/widgets.js?version=2021-17-07"></script> <script src="src/widgets.js?version=2021-17-07"></script>
<script src="src/blocks.js?version=2021-11-08"></script> <script src="src/blocks.js?version=2021-11-09"></script>
<script src="src/threads.js?version=2021-11-08"></script> <script src="src/threads.js?version=2021-11-08"></script>
<script src="src/objects.js?version=2021-11-09"></script> <script src="src/objects.js?version=2021-11-09"></script>
<script src="src/scenes.js?version=2021-10-12"></script> <script src="src/scenes.js?version=2021-10-12"></script>
<script src="src/gui.js?version=2021-11-09"></script> <script src="src/gui.js?version=2021-11-09"></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=2021-07-19"></script> <script src="src/lists.js?version=2021-07-19"></script>
<script src="src/byob.js?version=2021-11-07"></script> <script src="src/byob.js?version=2021-11-09"></script>
<script src="src/tables.js?version=2021-05-07"></script> <script src="src/tables.js?version=2021-05-07"></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

@ -160,7 +160,7 @@ CustomCommandBlockMorph, ToggleButtonMorph, DialMorph, SnapExtensions*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2021-November-08'; modules.blocks = '2021-November-09';
var SyntaxElementMorph; var SyntaxElementMorph;
var BlockMorph; var BlockMorph;
@ -2623,8 +2623,13 @@ BlockMorph.prototype.scriptTarget = function () {
return ide.currentSprite; return ide.currentSprite;
} }
dlg = this.parentThatIsA(DialogBoxMorph); dlg = this.parentThatIsA(DialogBoxMorph);
if (dlg && isSnapObject(dlg.target)){ if (dlg) {
return dlg.target; if (isSnapObject(dlg.target)) {
return dlg.target;
}
if (dlg.target instanceof IDE_Morph) {
return dlg.target.currentSprite;
}
} }
throw new Error('script target cannot be found for orphaned block'); throw new Error('script target cannot be found for orphaned block');
}; };

Wyświetl plik

@ -110,7 +110,7 @@ WatcherMorph, XML_Serializer, SnapTranslator, SnapExtensions*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.byob = '2021-November-07'; modules.byob = '2021-November-09';
// Declarations // Declarations
@ -4140,11 +4140,11 @@ BlockExportDialogMorph.prototype.key = 'blockExport';
// BlockExportDialogMorph instance creation: // BlockExportDialogMorph instance creation:
function BlockExportDialogMorph(serializer, blocks) { function BlockExportDialogMorph(serializer, blocks, target) {
this.init(serializer, blocks); this.init(serializer, blocks, target);
} }
BlockExportDialogMorph.prototype.init = function (serializer, blocks) { BlockExportDialogMorph.prototype.init = function (serializer, blocks, target) {
// additional properties: // additional properties:
this.serializer = serializer; this.serializer = serializer;
this.blocks = blocks.slice(0); this.blocks = blocks.slice(0);
@ -4153,7 +4153,7 @@ BlockExportDialogMorph.prototype.init = function (serializer, blocks) {
// initialize inherited properties: // initialize inherited properties:
BlockExportDialogMorph.uber.init.call( BlockExportDialogMorph.uber.init.call(
this, this,
null, // target target, // target
() => this.exportBlocks(), () => this.exportBlocks(),
null // environment null // environment
); );
@ -4208,7 +4208,7 @@ BlockExportDialogMorph.prototype.buildContents = function () {
() => contains(this.blocks, definition), () => contains(this.blocks, definition),
null, null,
null, null,
block.fullImage() this.target ? block : block.fullImage()
); );
checkBox.setPosition(new Point( checkBox.setPosition(new Point(
x, x,

Wyświetl plik

@ -5134,7 +5134,8 @@ IDE_Morph.prototype.exportGlobalBlocks = function () {
if (this.stage.globalBlocks.length > 0) { if (this.stage.globalBlocks.length > 0) {
new BlockExportDialogMorph( new BlockExportDialogMorph(
this.serializer, this.serializer,
this.stage.globalBlocks this.stage.globalBlocks,
this
).popUp(this.world()); ).popUp(this.world());
} else { } else {
this.inform( this.inform(