summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-03-18 19:46:03 +0100
committerjmoenig <jens@moenig.org>2013-03-18 19:46:03 +0100
commita4241f1a53fc6bce57ae22b5a351b08bbbe88e43 (patch)
tree7380795a187ebc54e809bbe0186876fd07d02b35 /blocks.js
parentfd47df9cb982c9ee6d1e71e65ce407d914f5be6a (diff)
downloadsnap-yow-a4241f1a53fc6bce57ae22b5a351b08bbbe88e43.tar.gz
snap-yow-a4241f1a53fc6bce57ae22b5a351b08bbbe88e43.zip
Scalable Symbols
scales the green flag and turn-arrow symbols line stroke widths
Diffstat (limited to 'blocks.js')
-rw-r--r--blocks.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/blocks.js b/blocks.js
index ee5907e..9e74358 100644
--- a/blocks.js
+++ b/blocks.js
@@ -1372,7 +1372,7 @@ SyntaxElementMorph.prototype.fixLayout = function () {
}
// fix highlights, if any
- if (top.getHighlight()) {
+ if (top.getHighlight && top.getHighlight()) {
top.removeHighlight();
top.addHighlight();
}
@@ -6990,13 +6990,14 @@ SymbolMorph.prototype.drawSymbolFlag = function (canvas, color) {
// answer a canvas showing a flag
var ctx = canvas.getContext('2d'),
w = canvas.width,
+ l = Math.max(w / 12, 1),
h = canvas.height;
- ctx.lineWidth = 1; // w / 5;
+ ctx.lineWidth = l;
ctx.strokeStyle = color.toString();
ctx.beginPath();
- ctx.moveTo(0, 0);
- ctx.lineTo(0, canvas.height);
+ ctx.moveTo(l / 2, 0);
+ ctx.lineTo(l / 2, canvas.height);
ctx.stroke();
ctx.lineWidth = h / 2;
@@ -7118,11 +7119,13 @@ SymbolMorph.prototype.drawSymbolTurnRight = function (canvas, color) {
// answer a canvas showing a right-turning arrow
var ctx = canvas.getContext('2d'),
w = canvas.width,
+ l = Math.max(w / 10, 1),
r = w / 2;
+ ctx.lineWidth = l;
ctx.strokeStyle = color.toString();
ctx.beginPath();
- ctx.arc(r, r * 2, r - 1, radians(0), radians(-90), false);
+ ctx.arc(r, r * 2, r - l / 2, radians(0), radians(-90), false);
ctx.stroke();
ctx.fillStyle = color.toString();
@@ -7140,11 +7143,13 @@ SymbolMorph.prototype.drawSymbolTurnLeft = function (canvas, color) {
// answer a canvas showing a left-turning arrow
var ctx = canvas.getContext('2d'),
w = canvas.width,
+ l = Math.max(w / 10, 1),
r = w / 2;
+ ctx.lineWidth = l;
ctx.strokeStyle = color.toString();
ctx.beginPath();
- ctx.arc(r, r * 2, r - 1, radians(180), radians(-90), true);
+ ctx.arc(r, r * 2, r - l / 2, radians(180), radians(-90), true);
ctx.stroke();
ctx.fillStyle = color.toString();