support dragging costumes and sounds out from result bubbles

snap7
Jens Mönig 2022-01-27 18:54:22 +01:00
rodzic 01e1c34e36
commit 890a5e8471
4 zmienionych plików z 70 dodań i 18 usunięć

Wyświetl plik

@ -4,6 +4,7 @@
* **New Features:**
* support dragging blocks out from result bubbles, and from speech balloons and variable watchers when in edit mode
* support dragging costumes and sounds out from result bubbles
* support deleting and inserting individual variadic slots, script vars & ring params
* **Notable Changes:**
* **Notable Fixes:**
@ -14,6 +15,9 @@
* Hungarian, thank you, Attila Faragó, for this HUGE update!
* German
### 2022-01-27
* blocks, gui: support dragging costumes and sounds out from result bubbles
### 2022-01-26
* blocks: refactored slot context menus
* blocks: support for deleting and inserting individual script vars & ring params

Wyświetl plik

@ -16,11 +16,11 @@
<script src="src/morphic.js?version=2022-01-23"></script>
<script src="src/symbols.js?version=2021-03-03"></script>
<script src="src/widgets.js?version=2021-17-09"></script>
<script src="src/blocks.js?version=2022-01-26"></script>
<script src="src/blocks.js?version=2022-01-27"></script>
<script src="src/threads.js?version=2022-01-21"></script>
<script src="src/objects.js?version=2022-01-23"></script>
<script src="src/scenes.js?version=2021-11-24"></script>
<script src="src/gui.js?version=2022-01-21"></script>
<script src="src/gui.js?version=2022-01-27"></script>
<script src="src/paint.js?version=2021-07-05"></script>
<script src="src/lists.js?version=2021-12-15"></script>
<script src="src/byob.js?version=2022-01-07"></script>

Wyświetl plik

@ -154,13 +154,14 @@ fontHeight, TableFrameMorph, SpriteMorph, Context, ListWatcherMorph, Rectangle,
DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, WHITE, BLACK,
Costume, IDE_Morph, BlockDialogMorph, BlockEditorMorph, localize, CLEAR, Point,
isSnapObject, PushButtonMorph, SpriteIconMorph, Process, AlignmentMorph, List,
CustomCommandBlockMorph, ToggleButtonMorph, DialMorph, SnapExtensions*/
CustomCommandBlockMorph, ToggleButtonMorph, DialMorph, SnapExtensions,
CostumeIconMorph, SoundIconMorph*/
/*jshint esversion: 6*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2022-January-26';
modules.blocks = '2022-January-27';
var SyntaxElementMorph;
var BlockMorph;
@ -2250,8 +2251,56 @@ SyntaxElementMorph.prototype.showBubble = function (value, exportPic, target) {
morphToShow.bounds.setWidth(img.width);
morphToShow.bounds.setHeight(img.height);
morphToShow.cachedImage = img;
// support costumes to be dragged out of result bubbles:
morphToShow.isDraggable = true;
morphToShow.selectForEdit = function () {
var cst = value.copy(),
icon,
prepare;
cst.name = ide.currentSprite.newCostumeName(cst.name);
icon = new CostumeIconMorph(cst);
prepare = icon.prepareToBeGrabbed;
icon.prepareToBeGrabbed = function (hand) {
hand.grabOrigin = {
origin: ide.palette,
position: ide.palette.center()
};
this.prepareToBeGrabbed = prepare;
};
icon.setCenter(this.center());
return icon;
};
} else if (value instanceof Sound) {
morphToShow = new SymbolMorph('notes', 30);
// support sounds to be dragged out of result bubbles:
morphToShow.isDraggable = true;
morphToShow.selectForEdit = function () {
var snd = value.copy(),
icon,
prepare;
snd.name = ide.currentSprite.newSoundName(snd.name);
icon = new SoundIconMorph(snd);
prepare = icon.prepareToBeGrabbed;
icon.prepareToBeGrabbed = function (hand) {
hand.grabOrigin = {
origin: ide.palette,
position: ide.palette.center()
};
this.prepareToBeGrabbed = prepare;
};
icon.setCenter(this.center());
return icon;
};
} else if (value instanceof Context) {
img = value.image();
morphToShow = new Morph();

Wyświetl plik

@ -86,7 +86,7 @@ BlockVisibilityDialogMorph, ThreadManager*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2022-January-21';
modules.gui = '2022-January-27';
// Declarations
@ -1564,7 +1564,7 @@ IDE_Morph.prototype.createPalette = function (forSearching) {
droppedMorph.destroy();
this.removeSprite(droppedMorph.object);
} else if (droppedMorph instanceof CostumeIconMorph) {
this.currentSprite.wearCostume(null);
// this.currentSprite.wearCostume(null); // do we need this?
droppedMorph.perish(myself.isAnimating ? 200 : 0);
} else if (droppedMorph instanceof BlockMorph) {
this.stage.threads.stopAllForBlock(droppedMorph);
@ -1764,6 +1764,7 @@ IDE_Morph.prototype.createSpriteBar = function () {
// tab bar
tabBar.tabTo = function (tabString) {
var active;
myself.world().hand.destroyTemporaries();
myself.currentTab = tabString;
this.children.forEach(each => {
each.refresh();
@ -1890,12 +1891,6 @@ IDE_Morph.prototype.createSpriteEditor = function () {
this.spriteEditor.acceptsDrops = false;
this.spriteEditor.contents.acceptsDrops = false;
this.spriteEditor.contents.mouseEnterDragging = (morph) => {
if (morph instanceof BlockMorph) {
this.spriteBar.tabBar.tabTo('scripts');
}
};
} else if (this.currentTab === 'sounds') {
this.spriteEditor = new JukeboxMorph(
this.currentSprite,
@ -1906,12 +1901,6 @@ IDE_Morph.prototype.createSpriteEditor = function () {
this.spriteEditor.updateSelection();
this.spriteEditor.acceptDrops = false;
this.spriteEditor.contents.acceptsDrops = false;
this.spriteEditor.contents.mouseEnterDragging = (morph) => {
if (morph instanceof BlockMorph) {
this.spriteBar.tabBar.tabTo('scripts');
}
};
} else {
this.spriteEditor = new Morph();
this.spriteEditor.color = this.groupColor;
@ -1927,6 +1916,16 @@ IDE_Morph.prototype.createSpriteEditor = function () {
};
this.add(this.spriteEditor);
}
this.spriteEditor.contents.mouseEnterDragging = (morph) => {
if (morph instanceof BlockMorph) {
this.spriteBar.tabBar.tabTo('scripts');
} else if (morph instanceof CostumeIconMorph) {
this.spriteBar.tabBar.tabTo('costumes');
} else if (morph instanceof SoundIconMorph) {
this.spriteBar.tabBar.tabTo('sounds');
}
};
};
IDE_Morph.prototype.createCorralBar = function () {