fixed #186 (can't duplicate blocks with anchored comments)

pull/3/merge
jmoenig 2013-09-30 14:41:59 +02:00
rodzic 8eb98dc5b1
commit dc709c2e12
2 zmienionych plików z 11 dodań i 8 usunięć

Wyświetl plik

@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2013-August-02'; modules.blocks = '2013-September-30';
var SyntaxElementMorph; var SyntaxElementMorph;
var BlockMorph; var BlockMorph;
@ -2910,10 +2910,10 @@ BlockMorph.prototype.situation = function () {
// BlockMorph sticky comments // BlockMorph sticky comments
BlockMorph.prototype.prepareToBeGrabbed = function () { BlockMorph.prototype.prepareToBeGrabbed = function (hand) {
var myself = this; var myself = this;
this.allComments().forEach(function (comment) { this.allComments().forEach(function (comment) {
comment.startFollowing(myself); comment.startFollowing(myself, hand.world);
}); });
}; };
@ -10133,7 +10133,7 @@ CommentMorph.prototype.userMenu = function () {
menu.addItem( menu.addItem(
"duplicate", "duplicate",
function () { function () {
this.fullCopy().pickUp(this.world()); myself.fullCopy().pickUp(myself.world());
}, },
'make a copy\nand pick it up' 'make a copy\nand pick it up'
); );
@ -10252,14 +10252,13 @@ CommentMorph.prototype.align = function (topBlock, ignoreLayer) {
} }
}; };
CommentMorph.prototype.startFollowing = function (topBlock) { CommentMorph.prototype.startFollowing = function (topBlock, world) {
var myself = this;
this.align(topBlock); this.align(topBlock);
this.world().add(this); world.add(this);
this.addShadow(); this.addShadow();
this.stickyOffset = this.position().subtract(this.block.position()); this.stickyOffset = this.position().subtract(this.block.position());
this.step = function () { this.step = function () {
myself.setPosition(this.block.position().add(myself.stickyOffset)); this.setPosition(this.block.position().add(this.stickyOffset));
}; };
}; };

Wyświetl plik

@ -1925,3 +1925,7 @@ ______
130920 130920
------ ------
* Morphic: fixed #172, Rectangle.amountToTranslateWithin() for IF ON EDGE, BOUNCE * Morphic: fixed #172, Rectangle.amountToTranslateWithin() for IF ON EDGE, BOUNCE
130930
------
* Blocks: fixed #186 (can't duplicate blocks with anchored comments)