kopia lustrzana https://github.com/backface/turtlestitch
added object-naming extension primitive
rodzic
1f22de2511
commit
dd83287b85
|
@ -11,6 +11,7 @@
|
||||||
* threads: added exception handling primitives for try/catch
|
* threads: added exception handling primitives for try/catch
|
||||||
* extensions: added try-catch extension primitives
|
* extensions: added try-catch extension primitives
|
||||||
* updated try-catch library
|
* updated try-catch library
|
||||||
|
* extensions: added object-naming extension primitive
|
||||||
|
|
||||||
### 2021-06-15
|
### 2021-06-15
|
||||||
* extensions: tweaked world-map primitives
|
* extensions: tweaked world-map primitives
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
// Global settings /////////////////////////////////////////////////////
|
// Global settings /////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*global modules, List, StageMorph, Costume, SpeechSynthesisUtterance, Sound,
|
/*global modules, List, StageMorph, Costume, SpeechSynthesisUtterance, Sound,
|
||||||
IDE_Morph, CamSnapshotDialogMorph, SoundRecorderDialogMorph*/
|
IDE_Morph, CamSnapshotDialogMorph, SoundRecorderDialogMorph, SpriteMorph,
|
||||||
|
isSnapObject*/
|
||||||
|
|
||||||
modules.extensions = '2021-June-16';
|
modules.extensions = '2021-June-16';
|
||||||
|
|
||||||
|
@ -421,3 +422,26 @@ SnapExtensions.set(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Object properties (obj_)
|
||||||
|
|
||||||
|
SnapExtensions.set(
|
||||||
|
'obj_name(obj, name)',
|
||||||
|
function (obj, name, proc) {
|
||||||
|
var ide = this.parentThatIsA(IDE_Morph);
|
||||||
|
proc.assertType(obj, [SpriteMorph, StageMorph, Costume, Sound]);
|
||||||
|
if (isSnapObject(obj)) {
|
||||||
|
obj.setName(ide.newSpriteName(name, obj));
|
||||||
|
ide.recordUnsavedChanges();
|
||||||
|
} else if (obj instanceof Costume) {
|
||||||
|
obj.name = this.newCostumeName(name, obj);
|
||||||
|
obj.version = Date.now();
|
||||||
|
ide.hasChangedMedia = true;
|
||||||
|
ide.recordUnsavedChanges();
|
||||||
|
} else if (obj instanceof Sound) {
|
||||||
|
obj.name = ide.newSoundName(name);
|
||||||
|
ide.hasChangedMedia = true;
|
||||||
|
ide.recordUnsavedChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
Ładowanie…
Reference in New Issue