diff options
| author | Jens Mönig <jens@moenig.org> | 2015-06-25 13:07:57 +0200 |
|---|---|---|
| committer | Jens Mönig <jens@moenig.org> | 2015-06-25 13:07:57 +0200 |
| commit | 2a28dca75342eeffb013e0e2fc00ce29561e97ee (patch) | |
| tree | 9db5099e7540dd931e79a3aaf9083f5b4f70f85b /paint.js | |
| parent | 3885ced35aee903f74d48c293bc3f0665a38dba5 (diff) | |
| parent | aef56afebf1504a9ce09ee5668d00c3c1df17565 (diff) | |
| download | snap-2a28dca75342eeffb013e0e2fc00ce29561e97ee.tar.gz snap-2a28dca75342eeffb013e0e2fc00ce29561e97ee.zip | |
Merge pull request #837 from nathan/optim
Optimizations
Diffstat (limited to 'paint.js')
| -rw-r--r-- | paint.js | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -81,7 +81,7 @@ var PaintColorPickerMorph; // A complete paint editor -PaintEditorMorph.prototype = new DialogBoxMorph(); +PaintEditorMorph.prototype = Object.create(DialogBoxMorph.prototype); PaintEditorMorph.prototype.constructor = PaintEditorMorph; PaintEditorMorph.uber = DialogBoxMorph.prototype; @@ -92,6 +92,7 @@ function PaintEditorMorph() { } PaintEditorMorph.prototype.init = function () { + PaintEditorMorph.uber.init.call(this); // additional properties: this.paper = null; // paint canvas this.oncancel = null; @@ -476,7 +477,7 @@ PaintEditorMorph.prototype.getUserColor = function () { // A large hsl color picker -PaintColorPickerMorph.prototype = new Morph(); +PaintColorPickerMorph.prototype = Object.create(Morph.prototype); PaintColorPickerMorph.prototype.constructor = PaintColorPickerMorph; PaintColorPickerMorph.uber = Morph.prototype; @@ -485,6 +486,7 @@ function PaintColorPickerMorph(extent, action) { } PaintColorPickerMorph.prototype.init = function (extent, action) { + PaintColorPickerMorph.uber.init.call(this); this.setExtent(extent || new Point(200, 100)); this.action = action || nop; this.drawNew(); @@ -552,7 +554,7 @@ PaintColorPickerMorph.prototype.mouseMove = modify its image, based on a 'tool' property. */ -PaintCanvasMorph.prototype = new Morph(); +PaintCanvasMorph.prototype = Object.create(Morph.prototype); PaintCanvasMorph.prototype.constructor = PaintCanvasMorph; PaintCanvasMorph.uber = Morph.prototype; @@ -561,6 +563,7 @@ function PaintCanvasMorph(shift) { } PaintCanvasMorph.prototype.init = function (shift) { + PaintCanvasMorph.uber.init.call(this); this.rotationCenter = new Point(240, 180); this.dragRect = null; this.previousDragPoint = null; @@ -961,6 +964,7 @@ PaintCanvasMorph.prototype.buildContents = function () { }; PaintCanvasMorph.prototype.drawNew = function () { + if (!this.background) return; var can = newCanvas(this.extent()); this.merge(this.background, can); this.merge(this.paper, can); |
