我正在尝试将选择边框样式设置为在inkscape中显示(图像左侧)。 我试图将对象填充设置为零:
fabric.Object.prototype.set({
padding: 0,
});
如果我放大,这更明显,填充增长。
示例:Left side inkscape selection box style, right side actual fabric.js selection box
如何删除填充?
这是jsFiddle。
答案 0 :(得分:2)
由于笔划宽度,将strokeWidth:0
设置为对象。
<强> 样本 强>
var canvas = window.__canvas = new fabric.Canvas('canvas');
var rect = new fabric.Rect({left: 10, top: 10,strokeWidth:0, width: 60, height: 60, fill: 'blue'});
rect.editable = true;
rect.customType = 'shape';
rect.describtion = 'fabric.js rect object';
rect.cornerColor = 'red';
rect.borderColor = 'red';
rect.cornerSize = 8;
rect.padding = 0;
canvas.add(rect);
canvas.setActiveObject(rect);
canvas.setZoom(20);
&#13;
canvas{
border:2px solid #000;
}
&#13;
<script src="https://rawgit.com/kangax/fabric.js/master/dist/fabric.js"></script>
<canvas id="canvas" width="400" height="400"></canvas>
&#13;