summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-04-30 13:49:14 +0200
committerjmoenig <jens@moenig.org>2013-04-30 13:49:14 +0200
commit1505796e19fa90ea858fc348aa2cd79817f0aab6 (patch)
tree0671cc6e69a0593edecc3f98a1ac71e897244201
parented3b9d1959a2b0a98ae9ce0eaf04356871ecd1e7 (diff)
downloadsnap-yow-1505796e19fa90ea858fc348aa2cd79817f0aab6.tar.gz
snap-yow-1505796e19fa90ea858fc348aa2cd79817f0aab6.zip
Eraser symbol
-rw-r--r--blocks.js38
-rwxr-xr-xhistory.txt1
2 files changed, 36 insertions, 3 deletions
diff --git a/blocks.js b/blocks.js
index 6f20815..dd5fed7 100644
--- a/blocks.js
+++ b/blocks.js
@@ -153,7 +153,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.blocks = '2013-April-29';
+modules.blocks = '2013-April-30';
var SyntaxElementMorph;
var BlockMorph;
@@ -188,14 +188,14 @@ WorldMorph.prototype.customMorphs = function () {
/*
return [
new SymbolMorph(
- 'paintbucket',
+ 'eraser',
50,
new Color(250, 250, 250),
new Point(-1, -1),
new Color(20, 20, 20)
)
];
-*/
+
/*
var sm = new ScriptsMorph();
sm.setExtent(new Point(800, 600));
@@ -6826,6 +6826,8 @@ SymbolMorph.prototype.symbolCanvasColored = function (aColor) {
return this.drawSymbolCrosshairs(canvas, aColor);
case 'paintbucket':
return this.drawSymbolPaintbucket(canvas, aColor);
+ case 'eraser':
+ return this.drawSymbolEraser(canvas, aColor);
default:
return canvas;
}
@@ -7583,6 +7585,36 @@ SymbolMorph.prototype.drawSymbolPaintbucket = function (canvas, color) {
return canvas;
};
+SymbolMorph.prototype.drawSymbolEraser = function (canvas, color) {
+ // answer a canvas showing an eraser
+ var ctx = canvas.getContext('2d'),
+ w = canvas.width,
+ h = canvas.height,
+ n = canvas.width / 4,
+ l = Math.max(w / 20, 0.5);
+
+ ctx.strokeStyle = color.toString();
+ ctx.lineWidth = l * 2;
+ ctx.beginPath();
+ ctx.moveTo(n * 3, l);
+ ctx.lineTo(l, n * 3);
+ ctx.quadraticCurveTo(n, h, n * 2, n * 3);
+ ctx.lineTo(w - l, n);
+ ctx.closePath();
+ ctx.stroke();
+
+ ctx.fillStyle = color.toString();
+ ctx.beginPath();
+ ctx.moveTo(n * 3, 0);
+ ctx.lineTo(n * 1.5, n * 1.5);
+ ctx.lineTo(n * 2.5, n * 2.5);
+ ctx.lineTo(w, n);
+ ctx.closePath();
+ ctx.fill();
+
+ return canvas;
+};
+
// ColorSlotMorph //////////////////////////////////////////////////////
/*
diff --git a/history.txt b/history.txt
index 0d4f780..aefd875 100755
--- a/history.txt
+++ b/history.txt
@@ -1690,3 +1690,4 @@ ______
* Objects: Costume shrink-wrapping
* Morphic: Allow triggers to be dragged if so specified (#83)
* GUI: select dragged costume
+* Blocks: eraser symbol for paint editor