使用twaver已有一段时间,偶尔碰到忽略到的配置,一直没记录,今天把使用时碰到的问题记录下来,方便以后查阅
1.背景色
box.setStyle('background.type', 'vector');
box.setStyle('background.vector.fill', true);
box.setStyle('background.vector.fill.color', 'red');
2.iframe里嵌套拓扑时,点击全屏并没真正全屏,以下每次重适应即可
window.onresize = function(e){
mainPane.invalidate();
}
3.导出图片时,chrome60以上的无法导出图片,因为chrome为了安全,禁止从页面打开Data URI了,所以导出图片时不能直接window.open(canvas.toDataURI(), 'network.png');
而应该先打开页面,再写入内容即可
var w = window.open();
w.document.open();
w.document.write("<img src='"+canvas.toDataURL()+"'/)");
w.document.close();