1
如何在2.x測試版中爲文本,iText和Textbox準確獲取和設置下劃線,上劃線等屬性?有一些文件可用嗎?Fabric.js beta2 - 文本下劃線選項
如何在2.x測試版中爲文本,iText和Textbox準確獲取和設置下劃線,上劃線等屬性?有一些文件可用嗎?Fabric.js beta2 - 文本下劃線選項
var canvas = new fabric.Canvas('canvas');
var text = new fabric.Text('FabricJS is Awsome.',{
fontSize:'30',
left:50,
top:50,
underline:true
});
canvas.add(text);
//text.setSelectionStyles({overline:true},0,5);
canvas.renderAll();
function changeStyle(val){
text[val] = !text[val];
text.dirty = true;
canvas.renderAll();
}
canvas {
border: 2px dotted green;
}
<script src="https://rawgit.com/kangax/fabric.js/master/dist/fabric.js"></script>
<button onclick=changeStyle('underline')>underline</button>
<button onclick=changeStyle('overline')>overline</button>
<button onclick=changeStyle('linethrough')>linethrough</button><br>
<canvas id="canvas" width="400" height="400"></canvas>
同其他屬性集/從對象中獲取。 fabric.Text
優秀。非常感謝你! –
@SandorRozsa upvote並標記是否這是你想要的。乾杯;) – Durga
對不起durga - 錯過了那個... :-) –