summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-06-21 09:06:46 +0200
committerjmoenig <jens@moenig.org>2013-06-21 09:06:46 +0200
commit25ea3d4a16696989824df9994f4024ba5aebc7ca (patch)
treef8ab294e141e7cf3d422825c7142993c765554ac
parentbed3e03e65efdf1713036733ecbb011fae263b90 (diff)
downloadsnap-byow-25ea3d4a16696989824df9994f4024ba5aebc7ca.tar.gz
snap-byow-25ea3d4a16696989824df9994f4024ba5aebc7ca.zip
Morphic, Blocks: "flat" design fix
Handle manually "unshadowed" StringMorphs without throwing an exception. This lets you load the tools library into "flat" mode again.
-rw-r--r--blocks.js9
-rwxr-xr-xhistory.txt4
-rw-r--r--morphic.js16
3 files changed, 16 insertions, 13 deletions
diff --git a/blocks.js b/blocks.js
index 0e667aa..34317bb 100644
--- a/blocks.js
+++ b/blocks.js
@@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.blocks = '2013-June-20';
+modules.blocks = '2013-June-21';
var SyntaxElementMorph;
var BlockMorph;
@@ -1168,9 +1168,8 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
part.color = new Color(255, 255, 255);
part.isBold = true;
part.shadowColor = this.color.darker(this.labelContrast);
- if (!MorphicPreferences.isFlat) {
- part.shadowOffset = this.embossing;
- }
+ part.shadowOffset = MorphicPreferences.isFlat ?
+ new Point() : this.embossing;
part.drawNew();
}
return part;
@@ -8616,7 +8615,7 @@ ArgLabelMorph.prototype.fixLayout = function () {
if (this.parent) {
this.color = this.parent.color;
- shadowOffset = label.shadowOffset;
+ shadowOffset = label.shadowOffset || new Point();
// determine the shadow color for zebra coloring:
if (shadowOffset.x < 0) {
diff --git a/history.txt b/history.txt
index 7dca72f..12ca386 100755
--- a/history.txt
+++ b/history.txt
@@ -1748,3 +1748,7 @@ ______
* Blocks, BYOB, Lists, Objects: "flat" design enhancements for blocks and watchers
* Blocks: Multi-line input slots (TextSlotMorphs - %mlt)
* Objects: doMapCode() primitive now uses a multi-line input slot
+
+130621
+------
+* Morphic, Blocks: "flat" design fix: Handle manually "unshadowed" StringMorphs \ No newline at end of file
diff --git a/morphic.js b/morphic.js
index 5b2c67c..b154dc8 100644
--- a/morphic.js
+++ b/morphic.js
@@ -1035,7 +1035,7 @@
/*global window, HTMLCanvasElement, getMinimumFontHeight, FileReader, Audio,
FileList, getBlurredShadowSupport*/
-var morphicVersion = '2013-June-06';
+var morphicVersion = '2013-June-21';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
@@ -6975,6 +6975,7 @@ StringMorph.prototype.font = function () {
StringMorph.prototype.drawNew = function () {
var context, width, start, stop, i, p, c, x, y,
+ shadowOffset = this.shadowOffset || new Point(),
txt = this.isPassword ?
this.password('*', this.text.length) : this.text;
@@ -6985,14 +6986,13 @@ StringMorph.prototype.drawNew = function () {
// set my extent
width = Math.max(
- context.measureText(txt).width +
- Math.abs(this.shadowOffset.x),
+ context.measureText(txt).width + Math.abs(shadowOffset.x),
1
);
this.bounds.corner = this.bounds.origin.add(
new Point(
width,
- fontHeight(this.fontSize) + Math.abs(this.shadowOffset.y)
+ fontHeight(this.fontSize) + Math.abs(shadowOffset.y)
)
);
this.image.width = width;
@@ -7005,15 +7005,15 @@ StringMorph.prototype.drawNew = function () {
// first draw the shadow, if any
if (this.shadowColor) {
- x = Math.max(this.shadowOffset.x, 0);
- y = Math.max(this.shadowOffset.y, 0);
+ x = Math.max(shadowOffset.x, 0);
+ y = Math.max(shadowOffset.y, 0);
context.fillStyle = this.shadowColor.toString();
context.fillText(txt, x, fontHeight(this.fontSize) + y);
}
// now draw the actual text
- x = Math.abs(Math.min(this.shadowOffset.x, 0));
- y = Math.abs(Math.min(this.shadowOffset.y, 0));
+ x = Math.abs(Math.min(shadowOffset.x, 0));
+ y = Math.abs(Math.min(shadowOffset.y, 0));
context.fillStyle = this.color.toString();
if (this.isShowingBlanks) {