kopia lustrzana https://github.com/backface/turtlestitch
renamed pen accessor methods
rodzic
95ceafdd28
commit
fd258965f0
|
@ -52,6 +52,7 @@
|
||||||
### 2021-11-08
|
### 2021-11-08
|
||||||
* objects: renamed some internal color methods
|
* objects: renamed some internal color methods
|
||||||
* objects, store: renamed internal pen color channel cache
|
* objects, store: renamed internal pen color channel cache
|
||||||
|
* objects, blocks, threads: renamed internal pen accessor methods
|
||||||
|
|
||||||
### 2021-11-07
|
### 2021-11-07
|
||||||
* widgets, blocks, byob: allow block-instances to be dragged off from templates in the "hide blocks" dialog
|
* widgets, blocks, byob: allow block-instances to be dragged off from templates in the "hide blocks" dialog
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
<script src="src/morphic.js?version=2021-07-09"></script>
|
<script src="src/morphic.js?version=2021-07-09"></script>
|
||||||
<script src="src/symbols.js?version=2021-03-03"></script>
|
<script src="src/symbols.js?version=2021-03-03"></script>
|
||||||
<script src="src/widgets.js?version=2021-17-07"></script>
|
<script src="src/widgets.js?version=2021-17-07"></script>
|
||||||
<script src="src/blocks.js?version=2021-11-07"></script>
|
<script src="src/blocks.js?version=2021-11-08"></script>
|
||||||
<script src="src/threads.js?version=2021-10-22"></script>
|
<script src="src/threads.js?version=2021-11-08"></script>
|
||||||
<script src="src/objects.js?version=2021-11-08"></script>
|
<script src="src/objects.js?version=2021-11-08"></script>
|
||||||
<script src="src/scenes.js?version=2021-10-12"></script>
|
<script src="src/scenes.js?version=2021-10-12"></script>
|
||||||
<script src="src/gui.js?version=2021-11-07"></script>
|
<script src="src/gui.js?version=2021-11-07"></script>
|
||||||
|
|
|
@ -160,7 +160,7 @@ CustomCommandBlockMorph, ToggleButtonMorph, DialMorph, SnapExtensions*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.blocks = '2021-November-07';
|
modules.blocks = '2021-November-08';
|
||||||
|
|
||||||
var SyntaxElementMorph;
|
var SyntaxElementMorph;
|
||||||
var BlockMorph;
|
var BlockMorph;
|
||||||
|
@ -646,7 +646,7 @@ SyntaxElementMorph.prototype.labelParts = {
|
||||||
back : ['back']
|
back : ['back']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'%hsva': {
|
'%clrdim': {
|
||||||
type: 'input',
|
type: 'input',
|
||||||
tags: 'read-only static',
|
tags: 'read-only static',
|
||||||
menu: {
|
menu: {
|
||||||
|
|
|
@ -630,18 +630,18 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
category: 'pen',
|
category: 'pen',
|
||||||
spec: 'set pen color to %clr'
|
spec: 'set pen color to %clr'
|
||||||
},
|
},
|
||||||
setPenHSVA: {
|
setPenColorDimension: {
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
category: 'pen',
|
category: 'pen',
|
||||||
spec: 'set pen %hsva to %n',
|
spec: 'set pen %clrdim to %n',
|
||||||
defaults: [['hue'], 50]
|
defaults: [['hue'], 50]
|
||||||
},
|
},
|
||||||
changePenHSVA: {
|
changePenColorDimension: {
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
category: 'pen',
|
category: 'pen',
|
||||||
spec: 'change pen %hsva by %n',
|
spec: 'change pen %clrdim by %n',
|
||||||
defaults: [['hue'], 10]
|
defaults: [['hue'], 10]
|
||||||
},
|
},
|
||||||
getPenAttribute: {
|
getPenAttribute: {
|
||||||
|
@ -656,18 +656,18 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
category: 'pen',
|
category: 'pen',
|
||||||
spec: 'set background color to %clr'
|
spec: 'set background color to %clr'
|
||||||
},
|
},
|
||||||
setBackgroundHSVA: {
|
setBackgroundColorDimension: {
|
||||||
only: StageMorph,
|
only: StageMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
category: 'pen',
|
category: 'pen',
|
||||||
spec: 'set background %hsva to %n',
|
spec: 'set background %clrdim to %n',
|
||||||
defaults: [['hue'], 50]
|
defaults: [['hue'], 50]
|
||||||
},
|
},
|
||||||
changeBackgroundHSVA: {
|
changeBackgroundColorDimension: {
|
||||||
only: StageMorph,
|
only: StageMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
category: 'pen',
|
category: 'pen',
|
||||||
spec: 'change background %hsva by %n',
|
spec: 'change background %clrdim by %n',
|
||||||
defaults: [['hue'], 10]
|
defaults: [['hue'], 10]
|
||||||
},
|
},
|
||||||
changeSize: {
|
changeSize: {
|
||||||
|
@ -1608,25 +1608,41 @@ SpriteMorph.prototype.initBlockMigrations = function () {
|
||||||
inputs: [['front']]
|
inputs: [['front']]
|
||||||
},
|
},
|
||||||
setHue: {
|
setHue: {
|
||||||
selector: 'setPenHSVA',
|
selector: 'setPenColorDimension',
|
||||||
inputs: [['hue']],
|
inputs: [['hue']],
|
||||||
offset: 1
|
offset: 1
|
||||||
},
|
},
|
||||||
setBrightness: {
|
setBrightness: {
|
||||||
selector: 'setPenHSVA',
|
selector: 'setPenColorDimension',
|
||||||
inputs: [['brightness']],
|
inputs: [['brightness']],
|
||||||
offset: 1
|
offset: 1
|
||||||
},
|
},
|
||||||
|
setPenHSVA: {
|
||||||
|
selector: 'setPenColorDimension',
|
||||||
|
offset: 0
|
||||||
|
},
|
||||||
changeHue: {
|
changeHue: {
|
||||||
selector: 'changePenHSVA',
|
selector: 'changePenColorDimension',
|
||||||
inputs: [['hue']],
|
inputs: [['hue']],
|
||||||
offset: 1
|
offset: 1
|
||||||
},
|
},
|
||||||
changeBrightness: {
|
changeBrightness: {
|
||||||
selector: 'changePenHSVA',
|
selector: 'changePenColorDimension',
|
||||||
inputs: [['brightness']],
|
inputs: [['brightness']],
|
||||||
offset: 1
|
offset: 1
|
||||||
},
|
},
|
||||||
|
changePenHSVA: {
|
||||||
|
selector: 'changePenColorDimension',
|
||||||
|
offset: 0
|
||||||
|
},
|
||||||
|
setBackgroundHSVA: {
|
||||||
|
selector: 'setBackgroundColorDimension',
|
||||||
|
offset: 0
|
||||||
|
},
|
||||||
|
changeBackgroundHSVA: {
|
||||||
|
selector: 'changeBackgroundColorDimension',
|
||||||
|
offset: 0
|
||||||
|
},
|
||||||
reportIsFastTracking: {
|
reportIsFastTracking: {
|
||||||
selector: 'reportGlobalFlag',
|
selector: 'reportGlobalFlag',
|
||||||
inputs: [['turbo mode']],
|
inputs: [['turbo mode']],
|
||||||
|
@ -1719,10 +1735,10 @@ SpriteMorph.prototype.blockAlternatives = {
|
||||||
doPasteOn: ['doCutFrom'],
|
doPasteOn: ['doCutFrom'],
|
||||||
doCutFrom: ['doPasteOn'],
|
doCutFrom: ['doPasteOn'],
|
||||||
doStamp: ['clear', 'down', 'up'],
|
doStamp: ['clear', 'down', 'up'],
|
||||||
setPenHSVA: ['changePenHSVA'],
|
setPenColorDimension: ['changePenColorDimension'],
|
||||||
changePenHSVA: ['setPenHSVA'],
|
changePenColorDimension: ['setPenColorDimension'],
|
||||||
setBackgroundHSVA: ['changeBackgroundHSVA'],
|
setBackgroundColorDimension: ['changeBackgroundColorDimension'],
|
||||||
changeBackgroundHSVA: ['setBackgroundHSVA'],
|
changeBackgroundColorDimension: ['setBackgroundColorDimension'],
|
||||||
changeSize: ['setSize'],
|
changeSize: ['setSize'],
|
||||||
setSize: ['changeSize'],
|
setSize: ['changeSize'],
|
||||||
|
|
||||||
|
@ -2496,8 +2512,8 @@ SpriteMorph.prototype.blockTemplates = function (
|
||||||
blocks.push(block('getPenDown', this.inheritsAttribute('pen down?')));
|
blocks.push(block('getPenDown', this.inheritsAttribute('pen down?')));
|
||||||
blocks.push('-');
|
blocks.push('-');
|
||||||
blocks.push(block('setColor'));
|
blocks.push(block('setColor'));
|
||||||
blocks.push(block('changePenHSVA'));
|
blocks.push(block('changePenColorDimension'));
|
||||||
blocks.push(block('setPenHSVA'));
|
blocks.push(block('setPenColorDimension'));
|
||||||
blocks.push(block('getPenAttribute'));
|
blocks.push(block('getPenAttribute'));
|
||||||
blocks.push('-');
|
blocks.push('-');
|
||||||
blocks.push(block('changeSize'));
|
blocks.push(block('changeSize'));
|
||||||
|
@ -4416,7 +4432,7 @@ SpriteMorph.prototype.reportShown = function () {
|
||||||
|
|
||||||
// SpriteMorph pen color
|
// SpriteMorph pen color
|
||||||
|
|
||||||
SpriteMorph.prototype.setColorComponentHSVA = function (idx, num) {
|
SpriteMorph.prototype.setColorDimension = function (idx, num) {
|
||||||
var x = this.xPosition(),
|
var x = this.xPosition(),
|
||||||
y = this.yPosition(),
|
y = this.yPosition(),
|
||||||
n = +num;
|
n = +num;
|
||||||
|
@ -4442,7 +4458,7 @@ SpriteMorph.prototype.setColorComponentHSVA = function (idx, num) {
|
||||||
this.gotoXY(x, y);
|
this.gotoXY(x, y);
|
||||||
};
|
};
|
||||||
|
|
||||||
SpriteMorph.prototype.getColorComponentHSVA = function (idx) {
|
SpriteMorph.prototype.getColorDimension = function (idx) {
|
||||||
idx = +idx;
|
idx = +idx;
|
||||||
if (idx === 3) {
|
if (idx === 3) {
|
||||||
return (1 - this.color.a) * 100;
|
return (1 - this.color.a) * 100;
|
||||||
|
@ -4450,10 +4466,10 @@ SpriteMorph.prototype.getColorComponentHSVA = function (idx) {
|
||||||
return (this.cachedColorDimensions[idx] || 0) * 100;
|
return (this.cachedColorDimensions[idx] || 0) * 100;
|
||||||
};
|
};
|
||||||
|
|
||||||
SpriteMorph.prototype.changeColorComponentHSVA = function (idx, delta) {
|
SpriteMorph.prototype.changeColorDimension = function (idx, delta) {
|
||||||
this.setColorComponentHSVA(
|
this.setColorDimension(
|
||||||
idx,
|
idx,
|
||||||
this.getColorComponentHSVA(idx) + (+delta || 0)
|
this.getColorDimension(idx) + (+delta || 0)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4478,7 +4494,7 @@ SpriteMorph.prototype.getPenAttribute = function (attrib) {
|
||||||
if (name === 'size') {
|
if (name === 'size') {
|
||||||
return this.size || 0;
|
return this.size || 0;
|
||||||
}
|
}
|
||||||
return this.getColorComponentHSVA(options.indexOf(name));
|
return this.getColorDimension(options.indexOf(name));
|
||||||
};
|
};
|
||||||
|
|
||||||
// SpriteMorph layers
|
// SpriteMorph layers
|
||||||
|
@ -8780,8 +8796,8 @@ StageMorph.prototype.blockTemplates = function (
|
||||||
blocks.push(block('clear'));
|
blocks.push(block('clear'));
|
||||||
blocks.push('-');
|
blocks.push('-');
|
||||||
blocks.push(block('setBackgroundColor'));
|
blocks.push(block('setBackgroundColor'));
|
||||||
blocks.push(block('changeBackgroundHSVA'));
|
blocks.push(block('changeBackgroundColorDimension'));
|
||||||
blocks.push(block('setBackgroundHSVA'));
|
blocks.push(block('setBackgroundColorDimension'));
|
||||||
blocks.push('-');
|
blocks.push('-');
|
||||||
blocks.push(block('reportPenTrailsAsCostume'));
|
blocks.push(block('reportPenTrailsAsCostume'));
|
||||||
blocks.push('-');
|
blocks.push('-');
|
||||||
|
@ -9262,7 +9278,7 @@ StageMorph.prototype.newClone = nop;
|
||||||
|
|
||||||
// StageMorph background color setting
|
// StageMorph background color setting
|
||||||
|
|
||||||
StageMorph.prototype.setColorComponentHSVA = function (idx, num) {
|
StageMorph.prototype.setColorDimension = function (idx, num) {
|
||||||
var n = +num;
|
var n = +num;
|
||||||
|
|
||||||
idx = +idx;
|
idx = +idx;
|
||||||
|
@ -9283,11 +9299,11 @@ StageMorph.prototype.setColorComponentHSVA = function (idx, num) {
|
||||||
this.rerender();
|
this.rerender();
|
||||||
};
|
};
|
||||||
|
|
||||||
StageMorph.prototype.getColorComponentHSVA
|
StageMorph.prototype.getColorDimension =
|
||||||
= SpriteMorph.prototype.getColorComponentHSVA;
|
SpriteMorph.prototype.getColorDimension;
|
||||||
|
|
||||||
StageMorph.prototype.changeColorComponentHSVA
|
StageMorph.prototype.changeColorDimension =
|
||||||
= SpriteMorph.prototype.changeColorComponentHSVA;
|
SpriteMorph.prototype.changeColorDimension;
|
||||||
|
|
||||||
StageMorph.prototype.setColor = function (aColor) {
|
StageMorph.prototype.setColor = function (aColor) {
|
||||||
if (!this.color.eq(aColor, true)) { // observeAlpha
|
if (!this.color.eq(aColor, true)) { // observeAlpha
|
||||||
|
|
|
@ -4747,26 +4747,33 @@ Process.prototype.doSwitchToScene = function (id, transmission) {
|
||||||
|
|
||||||
// Process color primitives
|
// Process color primitives
|
||||||
|
|
||||||
Process.prototype.setHSVA = function (name, num) {
|
Process.prototype.setColorDimension = function (name, num) {
|
||||||
var options = ['hue', 'saturation', 'brightness', 'transparency'];
|
var options = ['hue', 'saturation', 'brightness', 'transparency'];
|
||||||
this.blockReceiver().setColorComponentHSVA(
|
this.blockReceiver().setColorDimension(
|
||||||
options.indexOf(this.inputOption(name)),
|
options.indexOf(this.inputOption(name)),
|
||||||
+num
|
+num
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Process.prototype.changeHSVA = function (name, num) {
|
Process.prototype.changeColorDimension = function (name, num) {
|
||||||
var options = ['hue', 'saturation', 'brightness', 'transparency'];
|
var options = ['hue', 'saturation', 'brightness', 'transparency'];
|
||||||
this.blockReceiver().changeColorComponentHSVA(
|
this.blockReceiver().changeColorDimension(
|
||||||
options.indexOf(this.inputOption(name)),
|
options.indexOf(this.inputOption(name)),
|
||||||
+num
|
+num
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Process.prototype.setPenHSVA = Process.prototype.setHSVA;
|
Process.prototype.setPenColorDimension =
|
||||||
Process.prototype.changePenHSVA = Process.prototype.changeHSVA;
|
Process.prototype.setColorDimension;
|
||||||
Process.prototype.setBackgroundHSVA = Process.prototype.setHSVA;
|
|
||||||
Process.prototype.changeBackgroundHSVA = Process.prototype.changeHSVA;
|
Process.prototype.changePenColorDimension =
|
||||||
|
Process.prototype.changeColorDimension;
|
||||||
|
|
||||||
|
Process.prototype.setBackgroundColorDimension =
|
||||||
|
Process.prototype.setColorDimension;
|
||||||
|
|
||||||
|
Process.prototype.changeBackgroundColorDimension =
|
||||||
|
Process.prototype.changeColorDimension;
|
||||||
|
|
||||||
// Process cutting & pasting primitives
|
// Process cutting & pasting primitives
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue