Hi guys,
I was trying to create some elements that can expand their width to full column. (like a normal image tag, not figure tag)
And by inserting code to Block.processChildren to set width/height, it works. The code is as follow:
if (Figure.isFigure(childNode)) {
...
else {
if (dom.hasClass(childNode, "scaleWidth")) {
var offsetWidth = childNode.parentNode.offsetWidth;
var imageHeight = (childNode.getAttribute("height") || childNode.getAttribute("data-height")) ;
var imageWidth = (childNode.getAttribute("width") || childNode.getAttribute("data-width")) ;
var ratio = (imageHeight && imageWidth ? imageHeight/imageWidth : 1);
//alert(imageHeight + " " + imageWidth);
childNode.setAttribute("width",offsetWidth );
childNode.setAttribute("height", offsetWidth * ratio );
}
// End
child = new Block(childNode, baseLineHeight, indices, !!isFallback);
if (isBlock && !owner.containsFallback) {
owner.containsFallback = child.containsFallback;
}
}
There is only one problem when the orientation changed, this need to be called again.
I'm not so sure about the whole flow, will it be possible for me to trigger this function everytime orientationChanged event ?
(is it currently recalled)
Thank you!
Nathan