support dragging costumes and sounds out from variable watchers

snap7
Jens Mönig 2022-01-27 23:38:10 +01:00
rodzic bc9142c251
commit d7f7efe4b2
2 zmienionych plików z 56 dodań i 2 usunięć

Wyświetl plik

@ -3,8 +3,7 @@
## in development:
* **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 and speech balloons
* support dragging blocks, costumes and sounds out from result bubbles, and from speech balloons and variable watchers when in edit mode
* support deleting and inserting individual variadic slots, script vars & ring params
* **Notable Changes:**
* **Notable Fixes:**
@ -18,6 +17,7 @@
### 2022-01-27
* blocks, gui: support dragging costumes and sounds out from result bubbles
* objects: support dragging costumes and sounds out from speech balloons
* objects: support dragging costumes and sounds out from variable watchers
### 2022-01-26
* blocks: refactored slot context menus

Wyświetl plik

@ -11538,8 +11538,62 @@ CellMorph.prototype.createContents = function () {
this.contentsMorph.bounds.setWidth(img.width);
this.contentsMorph.bounds.setHeight(img.height);
this.contentsMorph.cachedImage = img;
// support costumes to be dragged out of watchers:
this.contentsMorph.isDraggable = true;
this.contentsMorph.selectForEdit = function () {
var cst = myself.contents.copy(),
icon,
prepare,
ide = this.parentThatIsA(IDE_Morph)||
this.world().childThatIsA(IDE_Morph);
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;
};
if (ide.isAppMode) {return; }
icon.setCenter(this.center());
return icon;
};
} else if (this.contents instanceof Sound) {
this.contentsMorph = new SymbolMorph('notes', 30);
// support sounds to be dragged out of watchers:
this.contentsMorph.isDraggable = true;
this.contentsMorph.selectForEdit = function () {
var snd = myself.contents.copy(),
icon,
prepare,
ide = this.parentThatIsA(IDE_Morph)||
this.world().childThatIsA(IDE_Morph);
snd.name = ide.currentSprite.newCostumeName(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;
};
if (ide.isAppMode) {return; }
icon.setCenter(this.center());
return icon;
};
} else if (this.contents instanceof List) {
if (this.contents.isTable()) {
this.contentsMorph = new TableFrameMorph(new TableMorph(