made "import script" undoable

upd4.1
Jens Mönig 2017-09-28 08:54:10 +02:00
rodzic c580ac0efc
commit ad0d0f7803
4 zmienionych plików z 16 dodań i 18 usunięć

Wyświetl plik

@ -148,7 +148,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2017-September-26';
modules.blocks = '2017-September-28';
var SyntaxElementMorph;
var BlockMorph;

23
gui.js
Wyświetl plik

@ -4301,10 +4301,7 @@ IDE_Morph.prototype.openScriptString = function (str) {
IDE_Morph.prototype.rawOpenScriptString = function (str) {
var xml,
script,
scripts = this.currentSprite.scripts,
world = this.world(),
dropPosition = world.hand.position(),
myself = this;
scripts = this.currentSprite.scripts;
if (Process.prototype.isCatchingErrors) {
try {
@ -4317,18 +4314,16 @@ IDE_Morph.prototype.rawOpenScriptString = function (str) {
xml = this.serializer.loadScript(str, this.currentSprite);
script = this.serializer.loadScript(xml, this.currentSprite);
}
script.setPosition(this.world().hand.position());
scripts.add(script);
if (world.topMorphAt(dropPosition) !== scripts) {
dropPosition = new Point(
scripts.left() + scripts.cleanUpMargin,
scripts.top() + scripts.cleanUpMargin);
}
script.setCenter(dropPosition);
scripts.adjustBounds();
scripts.lastDroppedBlock = script;
scripts.recordDrop(
{
origin: this.palette,
position: this.palette.center()
}
);
this.showMessage(
'Imported Script.',
2

Wyświetl plik

@ -3667,6 +3667,8 @@ Fixes:
170928
------
* GUI: enable experimental setting for "ternary Boolean slots"
* GUI, Blocks: experimental feature: Download script, thanks, Bernat!
* Blocks: made "import script" undoable
v4.1 Features:
@ -3701,6 +3703,7 @@ v4.1 Features:
* prevent context menu and dragging for stage watchers in presentation mode
* "floating" search and make-a-block buttons in the blocks palette
* "Make a block" button in every category
* experimental "download script" feature
Fixes:
* changed keyboard shortcut indicator for “find blocks” to “^”

Wyświetl plik

@ -61,7 +61,7 @@ normalizeCanvas, contains*/
// Global stuff ////////////////////////////////////////////////////////
modules.store = '2017-September-01';
modules.store = '2017-September-28';
// XML_Serializer ///////////////////////////////////////////////////////
@ -1116,7 +1116,7 @@ SnapSerializer.prototype.loadBlock = function (model, isReporter, object) {
} else if (model.tag === 'custom-block') {
isGlobal = model.attributes.scope ? false : true;
receiver = isGlobal ? this.project.stage : object;
if (isGlobal && receiver) {
if (isGlobal) {
info = detect(receiver.globalBlocks, function (block) {
return block.blockSpec() === model.attributes.s;
});
@ -1128,7 +1128,7 @@ SnapSerializer.prototype.loadBlock = function (model, isReporter, object) {
}
);
}
} else if (receiver) {
} else {
// lookup in inherited methods
info = detect(receiver.customBlocks, function (block) {
return block.blockSpec() === model.attributes.s;