2.3.6
var canvas = window._canvas = new fabric.Canvas('c');
fabric.Object.prototype.objectCaching = false;
var TextObj = new fabric.Text('Text Text',{
left: 100,
top: 100,
fill: "#770faf",
width: 170,
height: 100,
underline: true
});
TextObj.setShadow({
color: 'rgba(0,0,0,0.7)',
blur: 10,
offsetX: 10,
offsetY: 10
});
canvas.add(TextObj);
canvas.renderAll();
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/2.3.6/fabric.js"></script>
<canvas id="c" width="400" height="400"></canvas>
objectCaching禁用了对象
fabric.Object.prototype.objectCaching = false;
阴影效果应显示在文本上并同时在其下划线。
在同一文本上加上下划线时,文本中未显示阴影效果