enable dropping commands into all rings, experimental, under construction

pull/89/head
jmoenig 2019-02-06 20:35:54 +01:00
rodzic 7e8a0198ba
commit b950976675
4 zmienionych plików z 88 dodań i 6 usunięć

Wyświetl plik

@ -26,6 +26,7 @@
* optimized in-project storage of atomic-data lists (more efficient, less space)
* remove all clones when the Green Flag is clicked
* adjust bottom of STOP block to reflect the menu selection (show / hide bottom notch)
* enable dropping commands into all rings, experimental, under construction
* Notable Fixes:
* "relabel" blocks with translated drop-down choices
* transforming arrayed to linked lists without loosing the last element
@ -39,7 +40,8 @@
### 2019-02-06
* Blocks, BYOB: refactored custom block input options and drop-down menus
* Blocks: adjust bottom of STOP block to reflect the menu selection (show / hide bottom notch)
* Blocks: adjust bottom of STOP block to reflect the menu selection (show / hide bottom notch)
* Blocks: enable dropping commands into all rings, under constructions
### 2019-02-05
* BYOB: radio button symbols for special slot / drop-down menu options

Wyświetl plik

@ -9,7 +9,7 @@
<script type="text/javascript" src="src/blocks.js?version=2019-02-06"></script>
<script type="text/javascript" src="src/threads.js?version=2019-01-28"></script>
<script type="text/javascript" src="src/objects.js?version=2019-01-28"></script>
<script type="text/javascript" src="src/gui.js?version=2019-01-28"></script>
<script type="text/javascript" src="src/gui.js?version=2019-02-06"></script>
<script type="text/javascript" src="src/paint.js?version=2018-10-02"></script>
<script type="text/javascript" src="src/lists.js?version=2019-01-10"></script>
<script type="text/javascript" src="src/byob.js?version=2019-02-06"></script>

Wyświetl plik

@ -4692,6 +4692,18 @@ CommandBlockMorph.prototype.snap = function (hand) {
}
};
CommandBlockMorph.prototype.prepareToBeGrabbed = function (handMorph) {
// +++
var oldPos = this.position();
nop(handMorph);
if (this.parent instanceof RingReporterSlotMorph) {
this.parent.revertToDefaultInput(this);
this.setPosition(oldPos);
}
CommandBlockMorph.uber.prepareToBeGrabbed.call(this, handMorph);
};
CommandBlockMorph.prototype.isStop = function () {
var choice;
if (this.selector === 'doStopThis') { // this could be cached...
@ -11594,6 +11606,8 @@ RingReporterSlotMorph.prototype.rfBorder
RingReporterSlotMorph.prototype.edge
= RingCommandSlotMorph.prototype.edge;
RingReporterSlotMorph.prototype.enableCommandDrops = false; // +++ not finished
// RingReporterSlotMorph instance creation:
function RingReporterSlotMorph(isPredicate) {
@ -11620,6 +11634,60 @@ RingReporterSlotMorph.prototype.replaceInput = function (source, target) {
}
};
///* under construction +++
// RingReporterSlotMorph attach targets for commands:
RingReporterSlotMorph.prototype.slotAttachPoint =
CommandSlotMorph.prototype.slotAttachPoint;
RingReporterSlotMorph.prototype.dentLeft =
CommandSlotMorph.prototype.dentLeft;
RingReporterSlotMorph.prototype.dentCenter =
CommandSlotMorph.prototype.dentCenter;
RingReporterSlotMorph.prototype.attachTargets = function () {
if (!RingReporterSlotMorph.prototype.enableCommandDrops ||
this.contents() instanceof ReporterBlockMorph
) {
// don't let commands "kick out" embedded reporters
return [];
}
return CommandSlotMorph.prototype.attachTargets.call(this);
};
// RingReporterSlotMorph nesting for commands:
RingReporterSlotMorph.prototype.nestedBlock = function (block) {
if (block) {
var nb = this.nestedBlock();
this.contents().destroy();
this.add(block);
if (nb) {
block.bottomBlock().nextBlock(nb);
}
this.fixLayout();
} else {
return detect(
this.children,
function (child) {
return child instanceof BlockMorph;
}
);
}
};
// RingReporterSlotMorph layout:
RingReporterSlotMorph.prototype.fixLayout = function () {
if (this.contents() instanceof CommandBlockMorph) {
CommandSlotMorph.prototype.fixLayout.call(this);
} else {
RingReporterSlotMorph.uber.fixLayout.call(this);
}
};
//*/
// RingReporterSlotMorph drawing:
RingReporterSlotMorph.prototype.drawRounded = function (context) {

Wyświetl plik

@ -61,13 +61,13 @@
/*global modules, Morph, SpriteMorph, SyntaxElementMorph, Color, Cloud,
ListWatcherMorph, TextMorph, newCanvas, useBlurredShadows, VariableFrame,
StringMorph, Point, MenuMorph, morphicVersion, DialogBoxMorph,normalizeCanvas,
ToggleButtonMorph, contains, ScrollFrameMorph, StageMorph, PushButtonMorph,
ToggleButtonMorph, contains, ScrollFrameMorph, StageMorph, PushButtonMorph, sb,
InputFieldMorph, FrameMorph, Process, nop, SnapSerializer, ListMorph, detect,
AlignmentMorph, TabMorph, Costume, MorphicPreferences, Sound, BlockMorph,
ToggleMorph, InputSlotDialogMorph, ScriptsMorph, isNil, SymbolMorph,
ToggleMorph, InputSlotDialogMorph, ScriptsMorph, isNil, SymbolMorph, fontHeight,
BlockExportDialogMorph, BlockImportDialogMorph, SnapTranslator, localize,
List, ArgMorph, Uint8Array, HandleMorph, SVG_Costume, TableDialogMorph,
fontHeight, sb, CommentMorph, CommandBlockMorph, BooleanSlotMorph,
CommentMorph, CommandBlockMorph, BooleanSlotMorph, RingReporterSlotMorph,
BlockLabelPlaceHolderMorph, Audio, SpeechBubbleMorph, ScriptFocusMorph,
XML_Element, WatcherMorph, BlockRemovalDialogMorph, saveAs, TableMorph,
isSnapObject, isRetinaEnabled, disableRetinaSupport, enableRetinaSupport,
@ -75,7 +75,7 @@ isRetinaSupported, SliderMorph, Animation, BoxMorph, MediaRecorder*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2019-January-28';
modules.gui = '2019-February-06';
// Declarations
@ -3141,6 +3141,18 @@ IDE_Morph.prototype.settingsMenu = function () {
'check to enable\nsaving linked sublist identities',
true
);
addPreference(
'Enable command drops in all rings',
function () {
RingReporterSlotMorph.prototype.enableCommandDrops =
!RingReporterSlotMorph.prototype.enableCommandDrops;
},
RingReporterSlotMorph.prototype.enableCommandDrops,
'UNDER CONSTRUCTION!\nuncheck to disable\ndropping commands in ' +
'reporter rings',
'UNDER CONSTRUCTION!\ncheck to enable\ndropping commands in all rings',
true
);
menu.popup(world, pos);
};