diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-08-11 18:49:29 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-08-11 18:49:29 -0400 |
| commit | 554463ca8e8492bfd5f0f496e3a2291bfb495f80 (patch) | |
| tree | ad78b5912cdf9a4e40f06292c8625a584df6cfcc /public/assets/javascripts/mx | |
| parent | d84c89a8dd770ea174a7d2ac90927046a5f4b5f6 (diff) | |
blueprint scaler stuff
Diffstat (limited to 'public/assets/javascripts/mx')
| -rw-r--r-- | public/assets/javascripts/mx/primitives/mx.image.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/public/assets/javascripts/mx/primitives/mx.image.js b/public/assets/javascripts/mx/primitives/mx.image.js index f9de141..33b1373 100644 --- a/public/assets/javascripts/mx/primitives/mx.image.js +++ b/public/assets/javascripts/mx/primitives/mx.image.js @@ -1,5 +1,7 @@ MX.Image = MX.Object3D.extend({ init: function (ops) { + ops = ops || {} + this.type = "Image" this.media = ops.media this.width = 0 @@ -41,15 +43,20 @@ MX.Image = MX.Object3D.extend({ layer.dirty = true layer.update() layer.ops.onload + + if (ops.keepImage) { + layer.image = image + } } - image.src = ops.src; - - if (ops.keepImage) { - this.image = image - } + + if (ops.src) image.src = ops.src + else if (ops.media) image.src = ops.media.url + else if (ops.url) image.src = ops.url }, draw: function(ctx, recenter){ + if (! this.image) { return } + if (recenter) { ctx.save() ctx.scale(-1, 1) |
