parent
1602d7f610
commit
f4d3392687
|
@ -15,8 +15,19 @@
|
||||||
|
|
||||||
var ImageView = Backbone.View.extend({
|
var ImageView = Backbone.View.extend({
|
||||||
tagName: 'img',
|
tagName: 'img',
|
||||||
initialize: function(dataUrl) {
|
initialize: function(objectUrl, contentType, blob) {
|
||||||
this.dataUrl = dataUrl;
|
loadImage(blob, autoOrientedCanvas => {
|
||||||
|
this.el.replaceWith(autoOrientedCanvas);
|
||||||
|
this.render();
|
||||||
|
this.update();
|
||||||
|
}, {
|
||||||
|
orientation: true,
|
||||||
|
// From CSS:
|
||||||
|
// maxWidth: 30em --> 420px
|
||||||
|
// maxHeight: 300px
|
||||||
|
maxWidth: 420,
|
||||||
|
maxHeight: 300,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'load': 'update',
|
'load': 'update',
|
||||||
|
@ -25,7 +36,11 @@
|
||||||
this.trigger('update');
|
this.trigger('update');
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
this.$el.attr('src', this.dataUrl);
|
if (!this.source) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$el.attr('src', this.source);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue