Template for issues
HTML
<script src="https://rawgithub.com/kangax/fabric.js/master/dist/fabric.js"></script>
<canvas id="c" width="600" height="600"></canvas>
CSS
canvas {
border: 1px solid #999;
}
JavaScript
/**
* fabric.js template for bug reports
*
* Please update the name of the jsfiddle (see Fiddle Options).
* This templates uses latest dev verison of fabric.js (https://rawgithub.com/kangax/fabric.js/master/dist/fabric.js).
*/
// initialize fabric canvas and assign to global windows object for debug
var canvas = window._canvas = new fabric.Canvas('c');
function pick() {
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (e) {
throw e;
}(new Error('Pick requires obj arg'));
var keys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
throw e;
}(new Error('Pick requires keys arg'));
var newObj = {};
keys.forEach(function (key) {
newObj[key] = obj[key];
});
return newObj;
}
// ADD YOUR CODE HERE
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
// Extended fabric line class
var LineArrow = fabric.util.createClass(fabric.Line, {
type: 'lineArrow',
initialize: function initialize(element) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _options$controlRadiu = options.controlRadius,
controlRadius = _options$controlRadiu === void 0 ? 20 : _options$controlRadiu,
_options$controlLineW = options.controlLineWidth,
controlLineWidth = _options$controlLineW ===...