JSFiddle - React, Tailwind, and code Playground

by InferOn

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/fabric.js/1.4.13/fabric.min.js"></script>
<canvas id="c" height="800" width="800"></canvas>

JavaScript

(function (global) {

  "use strict";

  var fabric = global.fabric || (global.fabric = {}),
      toFixed = fabric.util.toFixed,
      min = fabric.util.array.min;

  if (fabric.PolylinePlus) {
    fabric.warn('fabric.PolylinePlus is already defined');
    return;
  }

  /**
   * PolylinePlus class
   * @class fabric.PolylinePlus
   * @extends fabric.Object
   */
  fabric.PolylinePlus = fabric.util.createClass(fabric.Object, /** @lends fabric.PolylinePlus.prototype */ {

    /**
     * Type of an object
     * @type String
     * @default
     */
    type: 'PolylinePlus',

    /**
     * Constructor
     * @param {Array} points Array of points
     * @param {Object} [options] Options object
     * @param {Boolean} [skipOffset] Whether points offsetting should be skipped
     * @return {fabric.PolylinePlus} thisArg
     */
    initialize: function (points, options, skipOffset) {
      options = options || {};
      this.set('points', points);
      this.callSuper('initialize', options);
      this._calcDimensions(skipOffset);
      this.empty = options.empty;
    },

    /**
     * @private
     * @param {Boolean} [skipOffset] Whether points offsetting should be skipped
     */
    _calcDimensions: function (skipOffset) {
      return fabric.Polygon.prototype._calcDimensions.call(this, skipOffset);
    },

    /**
     * Returns object representation of an instance
     * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output
     * @return {Object} Object representation of an instance
     */
    toObject: function (propertiesToInclude) {
      return fabric.Polygon.prototype.toObject.call(this, propertiesToInclude);
    },

    /* _TO_SVG_START_ */
    /**
     * Returns SVG representation of an instance
     * @return {String} svg representation of an instance
     */
    toSVG: function () {
      var points = [],
          markup = this._createBaseSVGMarkup();

      for (var i = 0, len =...