Fabric.js 指定线头样式

Fabric.js specify lineCap style

html5 canvas中可以指定lineCap style作为行尾。

例如:

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.lineCap="round";    // <-- here lineCap is specified
ctx.moveTo(20,20);
ctx.lineTo(200,20);

可能的选项是:butt (Default), round, square

我的问题是:
使用 fabric.js 创建 Line 时如何指定 lineCap 样式?

var line = new fabric.Line(
    [0, 100, 200, 100],
    {
        strokeWidth: 5
        // I presume some option should be specified here, but how is it should be called?
    }
);

我找到了答案

将它张贴在这里,因为它在 fabric.js 文档中并不明显:

var line = new fabric.Line(
    [0, 100, 200, 100],
    {
        strokeWidth: 5,
        strokeLineCap: "round"   // <-- this makes 'round' line ends style
    }
);