drag-origin support for blocks and comments duplicated inside a block editor

pull/29/head
jmoenig 2016-11-24 09:30:35 +01:00
rodzic c1668c4f15
commit 3c43d59bc3
2 zmienionych plików z 17 dodań i 2 usunięć

Wyświetl plik

@ -149,7 +149,7 @@ isSnapObject, copy, PushButtonMorph, SpriteIconMorph, Process*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2016-November-23'; modules.blocks = '2016-November-24';
var SyntaxElementMorph; var SyntaxElementMorph;
var BlockMorph; var BlockMorph;
@ -2378,8 +2378,15 @@ BlockMorph.prototype.userMenu = function () {
"duplicate", "duplicate",
function () { function () {
var dup = myself.fullCopy(), var dup = myself.fullCopy(),
ide = myself.parentThatIsA(IDE_Morph); ide = myself.parentThatIsA(IDE_Morph),
blockEditor = myself.parentThatIsA(BlockEditorMorph);
dup.pickUp(world); dup.pickUp(world);
// register the drop-origin, so the block can
// slide back to its former situation if dropped
// somewhere where it gets rejected
if (!ide && blockEditor) {
ide = blockEditor.target.parentThatIsA(IDE_Morph);
}
if (ide) { if (ide) {
world.hand.grabOrigin = { world.hand.grabOrigin = {
origin: ide.palette, origin: ide.palette,
@ -5821,8 +5828,15 @@ ScriptsMorph.prototype.scriptsPicture = function () {
ScriptsMorph.prototype.addComment = function () { ScriptsMorph.prototype.addComment = function () {
var ide = this.parentThatIsA(IDE_Morph), var ide = this.parentThatIsA(IDE_Morph),
blockEditor = this.parentThatIsA(BlockEditorMorph),
world = this.world(); world = this.world();
new CommentMorph().pickUp(world); new CommentMorph().pickUp(world);
// register the drop-origin, so the element can
// slide back to its former situation if dropped
// somewhere where it gets rejected
if (!ide && blockEditor) {
ide = blockEditor.target.parentThatIsA(IDE_Morph);
}
if (ide) { if (ide) {
world.hand.grabOrigin = { world.hand.grabOrigin = {
origin: ide.palette, origin: ide.palette,

Wyświetl plik

@ -3134,3 +3134,4 @@ http://snap.berkeley.edu/run#cloud:Username=jens&ProjectName=rotation
161124 161124
------ ------
* Morphic, Store: work around a dreaded FF NS_ERROR_FAILURE for supporting retina * Morphic, Store: work around a dreaded FF NS_ERROR_FAILURE for supporting retina
* Blocks: drag-origin support for blocks and comments duplicated inside a block editor