summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCode WvS <code-wvs@quantentunnel.de>2015-03-28 09:43:59 +0100
committerCode WvS <code-wvs@quantentunnel.de>2015-03-28 09:43:59 +0100
commit0f85420767b00ce706fd6646ff812b169962ac60 (patch)
tree385ded45148464c0b6b64718f171958eeae91b86
parent43e5b2eaf6897614a85f68f3b66e8db1a0af0282 (diff)
downloadsnap-yow-0f85420767b00ce706fd6646ff812b169962ac60.tar.gz
snap-yow-0f85420767b00ce706fd6646ff812b169962ac60.zip
extend clear block to remove only a sprite's own trails
-rw-r--r--blocks.js12
-rw-r--r--lang-de.js8
-rw-r--r--objects.js13
3 files changed, 28 insertions, 5 deletions
diff --git a/blocks.js b/blocks.js
index 6f3ed28..858d08a 100644
--- a/blocks.js
+++ b/blocks.js
@@ -1277,6 +1277,18 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
);
part.setContents(['a line']);
break;
+ case '%clearmode':
+ part = new InputSlotMorph(
+ null, // text
+ false, // numeric?
+ {
+ 'my pen trails': ['my pen trails'],
+ 'all pen trails': ['all pen trails']
+ },
+ true
+ );
+ part.setContents(['all pen trails']);
+ break;
// symbols:
diff --git a/lang-de.js b/lang-de.js
index 8e24beb..46cdbc7 100644
--- a/lang-de.js
+++ b/lang-de.js
@@ -401,8 +401,12 @@ SnapTranslator.dict.de = {
'Tempo',
// pen:
- 'clear':
- 'wische',
+ 'clear %clearmode':
+ 'wische %clearmode',
+ 'my pen trails':
+ 'meine Malspuren',
+ 'all pen trails':
+ 'alle Malspuren',
'pen down':
'Stift runter',
'pen up and finish as %drawmode':
diff --git a/objects.js b/objects.js
index cf56086..b48cc6b 100644
--- a/objects.js
+++ b/objects.js
@@ -535,7 +535,7 @@ SpriteMorph.prototype.initBlocks = function () {
clear: {
type: 'command',
category: 'pen',
- spec: 'clear'
+ spec: 'clear %clearmode'
},
down: {
only: SpriteMorph,
@@ -3106,8 +3106,15 @@ SpriteMorph.prototype.doStamp = function () {
}
};
-SpriteMorph.prototype.clear = function () {
- this.parent.clearPenTrails();
+SpriteMorph.prototype.clear = function (mode) {
+ if (mode == 'my pen trails') {
+ window.penTrails.removeLayer(this.penShapes);
+ window.penTrails.removeLayer(this.penLines);
+ this.penShapes = L.layerGroup().addTo(window.penTrails);
+ this.penLines = L.layerGroup().addTo(window.penTrails);
+ } else {
+ this.parent.clearPenTrails();
+ }
};
// SpriteMorph pen size