fix image width/height code

pull/831/head
Gordon Williams 2021-09-30 17:00:46 +01:00
parent c8e86dc78a
commit c5d7a73f4f
1 changed files with 9 additions and 6 deletions

View File

@ -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