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