mirror of https://github.com/espruino/BangleApps
fix image width/height code
parent
c8e86dc78a
commit
c5d7a73f4f
|
@ -312,14 +312,17 @@ Layout.prototype.update = function() {
|
|||
l._h = 24;
|
||||
l._w = 14 + l.label.length*8;
|
||||
}, "img": function(l) {
|
||||
var src = l.src();
|
||||
if (typeof(src) === 'object') {
|
||||
l._h = ("width" in src) ? src.width : src.getWidth();
|
||||
l._w = ("height" in src) ? src.height : src.getHeight();
|
||||
var src = l.src(); // get width and height out of image
|
||||
if (src[0]) {
|
||||
l._w = src[0];
|
||||
l._h = src[1];
|
||||
} else if ('object'==typeof src) {
|
||||
l._w = ("width" in src) ? src.width : src.getWidth();
|
||||
l._h = ("height" in src) ? src.height : src.getHeight();
|
||||
} else {
|
||||
var im = E.toString(src);
|
||||
l._h = im.charCodeAt(0);
|
||||
l._w = im.charCodeAt(1);
|
||||
l._w = im.charCodeAt(0);
|
||||
l._h = im.charCodeAt(1);
|
||||
}
|
||||
}, "": function(l) {
|
||||
// size should already be set up in width/height
|
||||
|
|
Loading…
Reference in New Issue