kopia lustrzana https://github.com/backface/turtlestitch
added hooks for dynamic symbols coloring
rodzic
6d7213588f
commit
f0c340b200
|
@ -5,6 +5,7 @@
|
|||
### 2020-07-20
|
||||
* objects: fixed a list-watcher direct-editing offset bug
|
||||
* morphic: update the Hand's position on mouse-down - avoid triggering at the origin point
|
||||
* symbols: added hooks for dynamic coloring
|
||||
|
||||
### 2020-07-19
|
||||
* blocks: blocks-fade-out support for label arrows (under construction)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<title>Snap! Build Your Own Blocks 6.0.1 - dev -</title>
|
||||
<link rel="shortcut icon" href="src/favicon.ico">
|
||||
<script src="src/morphic.js?version=2020-07-20"></script>
|
||||
<script src="src/symbols.js?version=2020-07-01"></script>
|
||||
<script src="src/symbols.js?version=2020-07-20"></script>
|
||||
<script src="src/widgets.js?version=2020-07-13"></script>
|
||||
<script src="src/blocks.js?version=2020-07-20"></script>
|
||||
<script src="src/threads.js?version=2020-07-09"></script>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.symbols = '2020-July-13';
|
||||
modules.symbols = '2020-July-20';
|
||||
|
||||
var SymbolMorph;
|
||||
|
||||
|
@ -194,6 +194,18 @@ SymbolMorph.prototype.setLabelColor = function (
|
|||
this.setColor(textColor);
|
||||
};
|
||||
|
||||
// SymbolMorph dynamic coloring:
|
||||
|
||||
SymbolMorph.prototype.getRenderColor = function () {
|
||||
// answer the rendering color, can be overridden for my children
|
||||
return this.color;
|
||||
};
|
||||
|
||||
SymbolMorph.prototype.getShadowRenderColor = function () {
|
||||
// answer the shadow rendering color, can be overridden for my children
|
||||
return this.shadowColor;
|
||||
};
|
||||
|
||||
// SymbolMorph layout:
|
||||
|
||||
SymbolMorph.prototype.setExtent = function (aPoint) {
|
||||
|
@ -221,12 +233,12 @@ SymbolMorph.prototype.render = function (ctx) {
|
|||
if (this.shadowColor) {
|
||||
ctx.save();
|
||||
ctx.translate(sx, sy);
|
||||
this.renderShape(ctx, this.shadowColor);
|
||||
this.renderShape(ctx, this.getShadowRenderColor());
|
||||
ctx.restore();
|
||||
}
|
||||
ctx.save();
|
||||
ctx.translate(x, y);
|
||||
this.renderShape(ctx, this.color);
|
||||
this.renderShape(ctx, this.getRenderColor());
|
||||
ctx.restore();
|
||||
};
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue