diff options
| author | jmoenig <jens@moenig.org> | 2013-03-19 10:34:10 +0100 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2013-03-19 10:34:10 +0100 |
| commit | 3f19a21cadf059ec17abc939739e98642239a08f (patch) | |
| tree | 2f005be420eb3d486eae3c567f7b8a358d818478 /blocks.js | |
| parent | b19493897d3c8ba84b545fc3879e41d22917e8c1 (diff) | |
| download | snap-yow-3f19a21cadf059ec17abc939739e98642239a08f.tar.gz snap-yow-3f19a21cadf059ec17abc939739e98642239a08f.zip | |
Scalable Comments, auto-positioning scaled scripts
including support for auto-positioning scaled scripts (so you don't
have to clean-up when scaling blocks)
Diffstat (limited to 'blocks.js')
| -rw-r--r-- | blocks.js | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -8738,9 +8738,13 @@ CommentMorph.uber = BoxMorph.prototype; // CommentMorph preferences settings (pseudo-inherited from SyntaxElement): -CommentMorph.prototype.fontSize = SyntaxElementMorph.prototype.fontSize; -CommentMorph.prototype.padding = 5; -CommentMorph.prototype.rounding = 8; +CommentMorph.prototype.refreshScale = function () { + CommentMorph.prototype.fontSize = SyntaxElementMorph.prototype.fontSize; + CommentMorph.prototype.padding = 5 * SyntaxElementMorph.prototype.scale; + CommentMorph.prototype.rounding = 8 * SyntaxElementMorph.prototype.scale; +}; + +CommentMorph.prototype.refreshScale(); // CommentMorph instance creation: @@ -8749,13 +8753,14 @@ function CommentMorph(contents) { } CommentMorph.prototype.init = function (contents) { - var myself = this; + var myself = this, + scale = SyntaxElementMorph.prototype.scale; this.block = null; // optional anchor block this.stickyOffset = null; // not to be persisted this.isCollapsed = false; this.titleBar = new BoxMorph( this.rounding, - 1.000001, // shadow bug in Chrome, + 1.000001 * scale, // shadow bug in Chrome, new Color(255, 255, 180) ); this.titleBar.color = new Color(255, 255, 180); @@ -8773,7 +8778,7 @@ CommentMorph.prototype.init = function (contents) { ); this.contents.isEditable = true; this.contents.enableSelecting(); - this.contents.maxWidth = 90; + this.contents.maxWidth = 90 * scale; this.contents.drawNew(); this.handle = new HandleMorph( this.contents, @@ -8782,13 +8787,13 @@ CommentMorph.prototype.init = function (contents) { -2, -2 ); - this.handle.setExtent(new Point(11, 11)); + this.handle.setExtent(new Point(11 * scale, 11 * scale)); this.anchor = null; CommentMorph.uber.init.call( this, this.rounding, - 1.000001, // shadow bug in Chrome, + 1.000001 * scale, // shadow bug in Chrome, new Color(255, 255, 180) ); this.color = new Color(255, 255, 220); |
