kopia lustrzana https://github.com/backface/turtlestitch
commit
ce876362bb
115
blocks.js
115
blocks.js
|
@ -246,52 +246,52 @@ SyntaxElementMorph.uber = Morph.prototype;
|
||||||
|
|
||||||
outline:
|
outline:
|
||||||
|
|
||||||
corner - radius of command block rounding
|
corner - radius of command block rounding
|
||||||
rounding - radius of reporter block rounding
|
rounding - radius of reporter block rounding
|
||||||
edge - width of 3D-ish shading box
|
edge - width of 3D-ish shading box
|
||||||
hatHeight - additional top space for hat blocks
|
hatHeight - additional top space for hat blocks
|
||||||
hatWidth - minimum width for hat blocks
|
hatWidth - minimum width for hat blocks
|
||||||
rfBorder - pixel width of reification border (grey outline)
|
rfBorder - pixel width of reification border (grey outline)
|
||||||
minWidth - minimum width for any syntax element's contents
|
minWidth - minimum width for any syntax element's contents
|
||||||
|
|
||||||
jigsaw shape:
|
jigsaw shape:
|
||||||
|
|
||||||
inset - distance from indentation to left edge
|
inset - distance from indentation to left edge
|
||||||
dent - width of indentation bottom
|
dent - width of indentation bottom
|
||||||
|
|
||||||
paddings:
|
paddings:
|
||||||
|
|
||||||
bottomPadding - adds to the width of the bottom most c-slot
|
bottomPadding - adds to the width of the bottom most c-slot
|
||||||
cSlotPadding - adds to the width of the open "C" in c-slots
|
cSlotPadding - adds to the width of the open "C" in c-slots
|
||||||
typeInPadding - adds pixels between text and edge in input slots
|
typeInPadding - adds pixels between text and edge in input slots
|
||||||
labelPadding - adds left/right pixels to block labels
|
labelPadding - adds left/right pixels to block labels
|
||||||
|
|
||||||
label:
|
label:
|
||||||
|
|
||||||
labelFontName - <string> specific font family name
|
labelFontName - <string> specific font family name
|
||||||
labelFontStyle - <string> generic font family name, cascaded
|
labelFontStyle - <string> generic font family name, cascaded
|
||||||
fontSize - duh
|
fontSize - duh
|
||||||
embossing - <Point> offset for embossing effect
|
embossing - <Point> offset for embossing effect
|
||||||
labelWidth - column width, used for word wrapping
|
labelWidth - column width, used for word wrapping
|
||||||
labelWordWrap - <bool> if true labels can break after each word
|
labelWordWrap - <bool> if true labels can break after each word
|
||||||
dynamicInputLabels - <bool> if true inputs can have dynamic labels
|
dynamicInputLabels - <bool> if true inputs can have dynamic labels
|
||||||
|
|
||||||
snapping:
|
snapping:
|
||||||
|
|
||||||
feedbackColor - <Color> for displaying drop feedbacks
|
feedbackColor - <Color> for displaying drop feedbacks
|
||||||
feedbackMinHeight - height of white line for command block snaps
|
feedbackMinHeight - height of white line for command block snaps
|
||||||
minSnapDistance - threshold when commands start snapping
|
minSnapDistance - threshold when commands start snapping
|
||||||
reporterDropFeedbackPadding - increases reporter drop feedback
|
reporterDropFeedbackPadding - increases reporter drop feedback
|
||||||
|
|
||||||
color gradients:
|
color gradients:
|
||||||
|
|
||||||
contrast - <percent int> 3D-ish shading gradient contrast
|
contrast - <percent int> 3D-ish shading gradient contrast
|
||||||
labelContrast - <percent int> 3D-ish label shading contrast
|
labelContrast - <percent int> 3D-ish label shading contrast
|
||||||
activeHighlight - <Color> for stack highlighting when active
|
activeHighlight - <Color> for stack highlighting when active
|
||||||
errorHighlight - <Color> for error highlighting
|
errorHighlight - <Color> for error highlighting
|
||||||
activeBlur - <pixels int> shadow for blurred activeHighlight
|
activeBlur - <pixels int> shadow for blurred activeHighlight
|
||||||
activeBorder - <pixels int> unblurred activeHighlight
|
activeBorder - <pixels int> unblurred activeHighlight
|
||||||
rfColor - <Color> for reified outlines and slot backgrounds
|
rfColor - <Color> for reified outlines and slot backgrounds
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SyntaxElementMorph.prototype.setScale = function (num) {
|
SyntaxElementMorph.prototype.setScale = function (num) {
|
||||||
|
@ -1068,7 +1068,8 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
|
||||||
part = new InputSlotMorph(
|
part = new InputSlotMorph(
|
||||||
null,
|
null,
|
||||||
false,
|
false,
|
||||||
{ color: ['color'],
|
{
|
||||||
|
color: ['color'],
|
||||||
fisheye: ['fisheye'],
|
fisheye: ['fisheye'],
|
||||||
whirl: ['whirl'],
|
whirl: ['whirl'],
|
||||||
pixelate: ['pixelate'],
|
pixelate: ['pixelate'],
|
||||||
|
@ -1968,14 +1969,14 @@ SyntaxElementMorph.prototype.endLayout = function () {
|
||||||
SyntaxElementMorph my most important attributes and public
|
SyntaxElementMorph my most important attributes and public
|
||||||
accessors are:
|
accessors are:
|
||||||
|
|
||||||
selector - (string) name of method to be triggered
|
selector - (string) name of method to be triggered
|
||||||
receiver() - answer the object (sprite) to which I apply
|
receiver() - answer the object (sprite) to which I apply
|
||||||
inputs() - answer an array with my arg slots and nested reporters
|
inputs() - answer an array with my arg slots and nested reporters
|
||||||
defaults - an optional Array containing default input values
|
defaults - an optional Array containing default input values
|
||||||
topBlock() - answer the top block of the stack I'm attached to
|
topBlock() - answer the top block of the stack I'm attached to
|
||||||
blockSpec - a formalized description of my label parts
|
blockSpec - a formalized description of my label parts
|
||||||
setSpec() - force me to change my label structure
|
setSpec() - force me to change my label structure
|
||||||
evaluate() - answer the result of my evaluation
|
evaluate() - answer the result of my evaluation
|
||||||
isUnevaluated() - answer whether I am part of a special form
|
isUnevaluated() - answer whether I am part of a special form
|
||||||
|
|
||||||
Zebra coloring provides a mechanism to alternate brightness of nested,
|
Zebra coloring provides a mechanism to alternate brightness of nested,
|
||||||
|
@ -2049,28 +2050,28 @@ SyntaxElementMorph.prototype.endLayout = function () {
|
||||||
|
|
||||||
arity: multiple
|
arity: multiple
|
||||||
|
|
||||||
%mult%x - where %x stands for any of the above single inputs
|
%mult%x - where %x stands for any of the above single inputs
|
||||||
%inputs - for an additional text label 'with inputs'
|
%inputs - for an additional text label 'with inputs'
|
||||||
%words - for an expandable list of default 2 (used in JOIN)
|
%words - for an expandable list of default 2 (used in JOIN)
|
||||||
%exp - for a static expandable list of minimum 0 (used in LIST)
|
%exp - for a static expandable list of minimum 0 (used in LIST)
|
||||||
%scriptVars - for an expandable list of variable reporter templates
|
%scriptVars - for an expandable list of variable reporter templates
|
||||||
%parms - for an expandable list of formal parameters
|
%parms - for an expandable list of formal parameters
|
||||||
%ringparms - the same for use inside Rings
|
%ringparms - the same for use inside Rings
|
||||||
|
|
||||||
special form: upvar
|
special form: upvar
|
||||||
|
|
||||||
%upvar - same as %t (inline variable reporter template)
|
%upvar - same as %t (inline variable reporter template)
|
||||||
|
|
||||||
special form: input name
|
special form: input name
|
||||||
|
|
||||||
%inputName - variable blob (used in input type dialog)
|
%inputName - variable blob (used in input type dialog)
|
||||||
|
|
||||||
examples:
|
examples:
|
||||||
|
|
||||||
'if %b %c else %c' - creates Scratch's If/Else block
|
'if %b %c else %c' - creates Scratch's If/Else block
|
||||||
'set pen color to %clr' - creates Scratch's Pen color block
|
'set pen color to %clr' - creates Scratch's Pen color block
|
||||||
'list %mult%s' - creates BYOB's list reporter block
|
'list %mult%s' - creates BYOB's list reporter block
|
||||||
'call %n %inputs' - creates BYOB's Call block
|
'call %n %inputs' - creates BYOB's Call block
|
||||||
'the script %parms %c' - creates BYOB's THE SCRIPT block
|
'the script %parms %c' - creates BYOB's THE SCRIPT block
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -2297,7 +2298,7 @@ BlockMorph.prototype.userMenu = function () {
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
"script pic with result...",
|
"script pic with result...",
|
||||||
function () {
|
function () {
|
||||||
top.ExportResultPic();
|
top.exportResultPic();
|
||||||
},
|
},
|
||||||
'open a new window\n' +
|
'open a new window\n' +
|
||||||
'with a picture of both\nthis script and its result',
|
'with a picture of both\nthis script and its result',
|
||||||
|
@ -4790,7 +4791,7 @@ ReporterBlockMorph.prototype.mouseClickLeft = function (pos) {
|
||||||
|
|
||||||
// ReporterBlock exporting picture with result bubble
|
// ReporterBlock exporting picture with result bubble
|
||||||
|
|
||||||
ReporterBlockMorph.prototype.ExportResultPic = function () {
|
ReporterBlockMorph.prototype.exportResultPic = function () {
|
||||||
var top = this.topBlock(),
|
var top = this.topBlock(),
|
||||||
receiver = top.receiver(),
|
receiver = top.receiver(),
|
||||||
stage;
|
stage;
|
||||||
|
@ -4804,7 +4805,6 @@ ReporterBlockMorph.prototype.ExportResultPic = function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ReporterBlockMorph deleting
|
// ReporterBlockMorph deleting
|
||||||
|
|
||||||
ReporterBlockMorph.prototype.userDestroy = function () {
|
ReporterBlockMorph.prototype.userDestroy = function () {
|
||||||
|
@ -8501,19 +8501,18 @@ TemplateSlotMorph.prototype.unflash = function () {
|
||||||
I am a diamond-shaped argument slot.
|
I am a diamond-shaped argument slot.
|
||||||
My block spec is
|
My block spec is
|
||||||
|
|
||||||
%b - Boolean
|
%b - Boolean
|
||||||
%boolUE - Boolean unevaluated
|
%boolUE - Boolean unevaluated
|
||||||
|
|
||||||
I can be directly edited. When the user clicks on me I toggle
|
I can be directly edited. When the user clicks on me I toggle
|
||||||
between <true>, <false> and <null> values.
|
between <true>, <false> and <null> values.
|
||||||
|
|
||||||
evaluate returns my value.
|
evaluate() returns my value.
|
||||||
|
|
||||||
my most important public attributes and accessors are:
|
my most important public attributes and accessors are:
|
||||||
|
|
||||||
value - user editable contents (Boolean or null)
|
value - user editable contents (Boolean or null)
|
||||||
setContents(Boolean/null) - display the argument (Boolean or null)
|
setContents(Boolean/null) - display the argument (Boolean or null)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// BooleanSlotMorph inherits from ArgMorph:
|
// BooleanSlotMorph inherits from ArgMorph:
|
||||||
|
@ -10729,7 +10728,7 @@ function BlockHighlightMorph() {
|
||||||
evaluation is handles by the interpreter
|
evaluation is handles by the interpreter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// MultiArgMorph inherits from ArgMorph:
|
// MultiArgMorph inherits from ArgMorph:
|
||||||
|
|
||||||
MultiArgMorph.prototype = new ArgMorph();
|
MultiArgMorph.prototype = new ArgMorph();
|
||||||
MultiArgMorph.prototype.constructor = MultiArgMorph;
|
MultiArgMorph.prototype.constructor = MultiArgMorph;
|
||||||
|
@ -11137,10 +11136,9 @@ MultiArgMorph.prototype.mappedCode = function (definitions) {
|
||||||
// MultiArgMorph arity evaluating:
|
// MultiArgMorph arity evaluating:
|
||||||
|
|
||||||
MultiArgMorph.prototype.evaluate = function () {
|
MultiArgMorph.prototype.evaluate = function () {
|
||||||
/*
|
// this is usually overridden by the interpreter. This method is only
|
||||||
this is usually overridden by the interpreter. This method is only
|
// called (and needed) for the variables menu.
|
||||||
called (and needed) for the variables menu.
|
|
||||||
*/
|
|
||||||
var result = [];
|
var result = [];
|
||||||
this.inputs().forEach(function (slot) {
|
this.inputs().forEach(function (slot) {
|
||||||
result.push(slot.evaluate());
|
result.push(slot.evaluate());
|
||||||
|
@ -11166,7 +11164,7 @@ MultiArgMorph.prototype.isEmptySlot = function () {
|
||||||
input's value along.
|
input's value along.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ArgLabelMorph inherits from ArgMorph:
|
// ArgLabelMorph inherits from ArgMorph:
|
||||||
|
|
||||||
ArgLabelMorph.prototype = new ArgMorph();
|
ArgLabelMorph.prototype = new ArgMorph();
|
||||||
ArgLabelMorph.prototype.constructor = ArgLabelMorph;
|
ArgLabelMorph.prototype.constructor = ArgLabelMorph;
|
||||||
|
@ -11276,10 +11274,9 @@ ArgLabelMorph.prototype.reactToGrabOf = function () {
|
||||||
// ArgLabelMorph evaluating:
|
// ArgLabelMorph evaluating:
|
||||||
|
|
||||||
ArgLabelMorph.prototype.evaluate = function () {
|
ArgLabelMorph.prototype.evaluate = function () {
|
||||||
/*
|
// this is usually overridden by the interpreter. This method is only
|
||||||
this is usually overridden by the interpreter. This method is only
|
// called (and needed) for the variables menu.
|
||||||
called (and needed) for the variables menu.
|
|
||||||
*/
|
|
||||||
return this.argMorph().evaluate();
|
return this.argMorph().evaluate();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11291,7 +11288,7 @@ ArgLabelMorph.prototype.isEmptySlot = function () {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
I am an unevaluated, non-editable, rf-colored, rounded or diamond
|
I am an unevaluated, non-editable, rf-colored, rounded or diamond
|
||||||
input slot. My current (only) use is in the THE BLOCK block.
|
input slot. My current (only) use is in the THE BLOCK block.
|
||||||
|
|
||||||
My command spec is %f
|
My command spec is %f
|
||||||
*/
|
*/
|
||||||
|
|
2
byob.js
2
byob.js
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
byob.js
|
byob.js
|
||||||
|
|
||||||
"build your own blocks" for SNAP!
|
"build your own blocks" for Snap!
|
||||||
based on morphic.js, widgets.js blocks.js, threads.js and objects.js
|
based on morphic.js, widgets.js blocks.js, threads.js and objects.js
|
||||||
inspired by Scratch
|
inspired by Scratch
|
||||||
|
|
||||||
|
|
2
gui.js
2
gui.js
|
@ -2500,7 +2500,7 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
'Execute on slider change',
|
'Execute on slider change',
|
||||||
'toggleSliderExecute',
|
'toggleSliderExecute',
|
||||||
ArgMorph.prototype.executeOnSliderEdit,
|
ArgMorph.prototype.executeOnSliderEdit,
|
||||||
'uncheck to supress\nrunning scripts\nwhen moving the slider',
|
'uncheck to suppress\nrunning scripts\nwhen moving the slider',
|
||||||
'check to run\nthe edited script\nwhen moving the slider'
|
'check to run\nthe edited script\nwhen moving the slider'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
37
morphic.js
37
morphic.js
|
@ -3849,9 +3849,7 @@ Morph.prototype.perish = function (msecs, onComplete) {
|
||||||
|
|
||||||
// Morph utilities:
|
// Morph utilities:
|
||||||
|
|
||||||
Morph.prototype.nop = function () {
|
Morph.prototype.nop = nop;
|
||||||
nop();
|
|
||||||
};
|
|
||||||
|
|
||||||
Morph.prototype.resize = function () {
|
Morph.prototype.resize = function () {
|
||||||
this.world().activeHandle = new HandleMorph(this);
|
this.world().activeHandle = new HandleMorph(this);
|
||||||
|
@ -4122,7 +4120,7 @@ Morph.prototype.developersMenu = function () {
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
"pick up",
|
"pick up",
|
||||||
'pickUp',
|
'pickUp',
|
||||||
'disattach and put \ninto the hand'
|
'detach and put \ninto the hand'
|
||||||
);
|
);
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
"attach...",
|
"attach...",
|
||||||
|
@ -6310,9 +6308,7 @@ SliderButtonMorph.prototype.init = function (orientation) {
|
||||||
SliderButtonMorph.uber.init.call(this, orientation);
|
SliderButtonMorph.uber.init.call(this, orientation);
|
||||||
};
|
};
|
||||||
|
|
||||||
SliderButtonMorph.prototype.autoOrientation = function () {
|
SliderButtonMorph.prototype.autoOrientation = nop;
|
||||||
nop();
|
|
||||||
};
|
|
||||||
|
|
||||||
SliderButtonMorph.prototype.drawNew = function () {
|
SliderButtonMorph.prototype.drawNew = function () {
|
||||||
var colorBak = this.color.copy();
|
var colorBak = this.color.copy();
|
||||||
|
@ -6548,9 +6544,7 @@ SliderMorph.prototype.init = function (
|
||||||
// this.drawNew();
|
// this.drawNew();
|
||||||
};
|
};
|
||||||
|
|
||||||
SliderMorph.prototype.autoOrientation = function () {
|
SliderMorph.prototype.autoOrientation = nop;
|
||||||
nop();
|
|
||||||
};
|
|
||||||
|
|
||||||
SliderMorph.prototype.rangeSize = function () {
|
SliderMorph.prototype.rangeSize = function () {
|
||||||
return this.stop - this.start;
|
return this.stop - this.start;
|
||||||
|
@ -9833,9 +9827,7 @@ ScrollFrameMorph.prototype.scrollY = function (steps) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ScrollFrameMorph.prototype.step = function () {
|
ScrollFrameMorph.prototype.step = nop;
|
||||||
nop();
|
|
||||||
};
|
|
||||||
|
|
||||||
ScrollFrameMorph.prototype.mouseDownLeft = function (pos) {
|
ScrollFrameMorph.prototype.mouseDownLeft = function (pos) {
|
||||||
if (!this.isScrollingByDragging) {
|
if (!this.isScrollingByDragging) {
|
||||||
|
@ -10026,7 +10018,6 @@ ScrollFrameMorph.prototype.developersMenu = function () {
|
||||||
return menu;
|
return menu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ScrollFrameMorph.prototype.toggleTextLineWrapping = function () {
|
ScrollFrameMorph.prototype.toggleTextLineWrapping = function () {
|
||||||
this.isTextLineWrapping = !this.isTextLineWrapping;
|
this.isTextLineWrapping = !this.isTextLineWrapping;
|
||||||
};
|
};
|
||||||
|
@ -11447,21 +11438,13 @@ WorldMorph.prototype.initEventListeners = function () {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
WorldMorph.prototype.mouseDownLeft = function () {
|
WorldMorph.prototype.mouseDownLeft = nop;
|
||||||
nop();
|
|
||||||
};
|
|
||||||
|
|
||||||
WorldMorph.prototype.mouseClickLeft = function () {
|
WorldMorph.prototype.mouseClickLeft = nop;
|
||||||
nop();
|
|
||||||
};
|
|
||||||
|
|
||||||
WorldMorph.prototype.mouseDownRight = function () {
|
WorldMorph.prototype.mouseDownRight = nop;
|
||||||
nop();
|
|
||||||
};
|
|
||||||
|
|
||||||
WorldMorph.prototype.mouseClickRight = function () {
|
WorldMorph.prototype.mouseClickRight = nop;
|
||||||
nop();
|
|
||||||
};
|
|
||||||
|
|
||||||
WorldMorph.prototype.wantsDropOf = function () {
|
WorldMorph.prototype.wantsDropOf = function () {
|
||||||
// allow handle drops if any drops are allowed
|
// allow handle drops if any drops are allowed
|
||||||
|
@ -11538,7 +11521,7 @@ WorldMorph.prototype.contextMenu = function () {
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
"fill page...",
|
"fill page...",
|
||||||
'fillPage',
|
'fillPage',
|
||||||
'let the World automatically\nadjust to browser resizings'
|
'let the World automatically\nadjust to browser resizing'
|
||||||
);
|
);
|
||||||
if (useBlurredShadows) {
|
if (useBlurredShadows) {
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
|
|
Ładowanie…
Reference in New Issue