2017-02-05 5 views
0

In html5 canvas ist es möglich, lineCap style für die Zeilenenden anzugeben.Fabric.js spezifizieren lineCap style

Z. B .:

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); 

Mögliche Optionen sind: butt (Default), round, square.

Meine Frage ist:
Wie lineCap Stil angeben, wenn die Line mit fabric.js zu schaffen?

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? 
    } 
); 

Antwort

1

fand ich eine Antwort

es hier Posting, da es nicht offensichtlich aus der fabric.js Dokumentation ist:

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