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mBAAgB,GAExD,IAEJ,EAEO,CACT,CAhjBiC,CAgjB/B,OAAO,eAAgB,OAAO,UAAY,CAC1C,SAAU,YAAY,QAAQ,KAC9B,eAAgB,YAAY,QAAQ,OACpC,WAAY,YAAY,QAAQ,OAChC,YAAa,YAAY,QAAQ,OACjC,WAAY,YAAY,QAAQ,OAChC,cAAe,YAAY,QAAQ,OACnC,UAAW,YAAY,QAAQ,OAC/B,gBAAiB,YAAY,QAAQ,OACrC,SAAU,YAAY,QAAQ,KAC9B,YAAa,oBACb,aAAc,oBACd,SAAU,YAAY,QAAQ,KAC9B,OAAQ,YAAY,QAAQ,OAC5B,SAAU,YAAY,QAAQ,OAC9B,iBAAkB,YAAY,QAAQ,KACtC,cAAe,YAAY,QAAQ,KACnC,UAAW,YAAY,QAAQ,OAC/B,UAAW,YAAY,QAAQ,OAC/B,cAAe,YAAY,QAAQ,OACnC,UAAW,YAAY,QAAQ,KAC/B,UAAW,YAAY,QAAQ,MAC9B,OAAO,aAAe,CACvB,SAAU,KACV,eAAgB,EAChB,WAAY,GACZ,YAAa,GACb,WAAY,OACZ,cAAe,UACf,UAAW,yBACX,gBAAiB,OACjB,UAAU,EACV,YAAa,IACb,aAAc,IACd,UAAU,EACV,OAAQ,GACR,SAAU,GACV,kBAAkB,EAClB,eAAe,EACf,UAAW,GACX,UAAW,GACX,cAAe,GACf,WAAW,EACX,WAAW,GACV,OAEH,QAAQ,QAAU,SAClB,OAAO,QAAU,QAAiB","file":"/npm/@syoon/react-canvas-draw@1.0.1/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@syoon/react-canvas-draw@1.0.1/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\n\nexports.__esModule = true;\nexports.default = undefined;\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _class, _temp;\n\nvar _react = require(\"react\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require(\"prop-types\");\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _lazyBrush = require(\"lazy-brush\");\n\nvar _catenaryCurve = require(\"catenary-curve\");\n\nvar _resizeObserverPolyfill = require(\"resize-observer-polyfill\");\n\nvar _resizeObserverPolyfill2 = _interopRequireDefault(_resizeObserverPolyfill);\n\nvar _drawImage = require(\"./drawImage\");\n\nvar _drawImage2 = _interopRequireDefault(_drawImage);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction midPointBtw(p1, p2) {\n  return {\n    x: p1.x + (p2.x - p1.x) / 2,\n    y: p1.y + (p2.y - p1.y) / 2\n  };\n}\n\nvar canvasStyle = {\n  display: \"block\",\n  position: \"absolute\"\n};\n\nvar canvasTypes = [{\n  name: \"interface\",\n  zIndex: 15\n}, {\n  name: \"drawing\",\n  zIndex: 11\n}, {\n  name: \"temp\",\n  zIndex: 12\n}, {\n  name: \"grid\",\n  zIndex: 10\n}];\n\nvar dimensionsPropTypes = _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]);\n\nvar _default = (_temp = _class = function (_PureComponent) {\n  _inherits(_default, _PureComponent);\n\n  function _default(props) {\n    _classCallCheck(this, _default);\n\n    var _this = _possibleConstructorReturn(this, _PureComponent.call(this, props));\n\n    _this.componentWillUnmount = function () {\n      _this.canvasObserver.unobserve(_this.canvasContainer);\n    };\n\n    _this.drawImage = function () {\n      if (!_this.props.imgSrc) return;\n\n      // Load the image\n      _this.image = new Image();\n\n      // Prevent SecurityError \"Tainted canvases may not be exported.\" #70\n      _this.image.crossOrigin = \"anonymous\";\n\n      // Draw the image once loaded\n      _this.image.onload = function () {\n        return (0, _drawImage2.default)({ ctx: _this.ctx.grid, img: _this.image });\n      };\n      _this.image.src = _this.props.imgSrc;\n    };\n\n    _this.undo = function () {\n      var lines = _this.lines.slice(0, -1);\n      _this.clear();\n      _this.simulateDrawingLines({ lines: lines, immediate: true });\n      _this.triggerOnChange();\n    };\n\n    _this.getSaveData = function () {\n      // Construct and return the stringified saveData object\n      return JSON.stringify({\n        lines: _this.lines,\n        width: _this.props.canvasWidth,\n        height: _this.props.canvasHeight\n      });\n    };\n\n    _this.loadSaveData = function (saveData) {\n      var immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _this.props.immediateLoading;\n\n      if (typeof saveData !== \"string\") {\n        throw new Error(\"saveData needs to be of type string!\");\n      }\n\n      var _JSON$parse = JSON.parse(saveData),\n          lines = _JSON$parse.lines,\n          width = _JSON$parse.width,\n          height = _JSON$parse.height;\n\n      if (!lines || typeof lines.push !== \"function\") {\n        throw new Error(\"saveData.lines needs to be an array!\");\n      }\n\n      _this.clear();\n\n      if (width === _this.props.canvasWidth && height === _this.props.canvasHeight) {\n        _this.simulateDrawingLines({\n          lines: lines,\n          immediate: immediate\n        });\n      } else {\n        // we need to rescale the lines based on saved & current dimensions\n        var scaleX = _this.props.canvasWidth / width;\n        var scaleY = _this.props.canvasHeight / height;\n        var scaleAvg = (scaleX + scaleY) / 2;\n\n        _this.simulateDrawingLines({\n          lines: lines.map(function (line) {\n            return _extends({}, line, {\n              points: line.points.map(function (p) {\n                return {\n                  x: p.x * scaleX,\n                  y: p.y * scaleY\n                };\n              }),\n              brushRadius: line.brushRadius * scaleAvg\n            });\n          }),\n          immediate: immediate\n        });\n      }\n    };\n\n    _this.simulateDrawingLines = function (_ref) {\n      var lines = _ref.lines,\n          immediate = _ref.immediate;\n\n      // Simulate live-drawing of the loaded lines\n      // TODO use a generator\n      var curTime = 0;\n      var timeoutGap = immediate ? 0 : _this.props.loadTimeOffset;\n\n      lines.forEach(function (line) {\n        var points = line.points,\n            brushColor = line.brushColor,\n            brushRadius = line.brushRadius;\n\n        // Draw all at once if immediate flag is set, instead of using setTimeout\n\n        if (immediate) {\n          // Draw the points\n          _this.drawPoints({\n            points: points,\n            brushColor: brushColor,\n            brushRadius: brushRadius\n          });\n\n          // Save line with the drawn points\n          _this.points = points;\n          _this.saveLine({ brushColor: brushColor, brushRadius: brushRadius, callChange: false });\n          return;\n        } else {\n          var _loop = function _loop(i) {\n            curTime += timeoutGap;\n            window.setTimeout(function () {\n              _this.drawPoints({\n                points: points.slice(0, i + 1),\n                brushColor: brushColor,\n                brushRadius: brushRadius\n              });\n            }, curTime);\n          };\n\n          // Use timeout to draw\n          for (var i = 1; i < points.length; i++) {\n            _loop(i);\n          }\n\n          curTime += timeoutGap;\n          window.setTimeout(function () {\n            // Save this line with its props instead of this.props\n            _this.points = points;\n            _this.saveLine({ brushColor: brushColor, brushRadius: brushRadius, callChange: true });\n          }, curTime);\n        }\n      });\n\n      // Only trigger change when the whole 'transaction' is complete, of drawing all the lines.\n      // Do not trigger if nothing was drawn || or the array was empty. That is unncessary\n      if (immediate && lines.length >= 1) {\n        _this.triggerOnChange();\n      }\n    };\n\n    _this.handleDrawStart = function (e) {\n      e.preventDefault();\n\n      // Start drawing\n      _this.isPressing = true;\n\n      var _this$getPointerPos = _this.getPointerPos(e),\n          x = _this$getPointerPos.x,\n          y = _this$getPointerPos.y;\n\n      if (e.touches && e.touches.length > 0) {\n        // on touch, set catenary position to touch pos\n        _this.lazy.update({ x: x, y: y }, { both: true });\n      }\n\n      // Ensure the initial down position gets added to our line\n      _this.handlePointerMove(x, y);\n    };\n\n    _this.handleDrawMove = function (e) {\n      e.preventDefault();\n\n      var _this$getPointerPos2 = _this.getPointerPos(e),\n          x = _this$getPointerPos2.x,\n          y = _this$getPointerPos2.y;\n\n      _this.handlePointerMove(x, y);\n    };\n\n    _this.handleDrawEnd = function (e) {\n      e.preventDefault();\n\n      // Draw to this end pos\n      _this.handleDrawMove(e);\n\n      // Stop drawing & save the drawn line\n      _this.isDrawing = false;\n      _this.isPressing = false;\n      _this.saveLine({ callChange: true });\n    };\n\n    _this.handleCanvasResize = function (entries, observer) {\n      var saveData = _this.getSaveData();\n      for (var _iterator = entries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n        var _ref2;\n\n        if (_isArray) {\n          if (_i >= _iterator.length) break;\n          _ref2 = _iterator[_i++];\n        } else {\n          _i = _iterator.next();\n          if (_i.done) break;\n          _ref2 = _i.value;\n        }\n\n        var entry = _ref2;\n        var _entry$contentRect = entry.contentRect,\n            width = _entry$contentRect.width,\n            height = _entry$contentRect.height;\n\n        _this.setCanvasSize(_this.canvas.interface, width, height);\n        _this.setCanvasSize(_this.canvas.drawing, width, height);\n        _this.setCanvasSize(_this.canvas.temp, width, height);\n        _this.setCanvasSize(_this.canvas.grid, width, height);\n\n        _this.drawGrid(_this.ctx.grid);\n        _this.drawImage();\n        _this.loop({ once: true });\n      }\n      _this.loadSaveData(saveData, true);\n    };\n\n    _this.setCanvasSize = function (canvas, width, height) {\n      canvas.width = width;\n      canvas.height = height;\n      canvas.style.width = width;\n      canvas.style.height = height;\n    };\n\n    _this.getPointerPos = function (e) {\n      var rect = _this.canvas.interface.getBoundingClientRect();\n\n      // use cursor pos as default\n      var clientX = e.clientX;\n      var clientY = e.clientY;\n\n      // use first touch if available\n      if (e.changedTouches && e.changedTouches.length > 0) {\n        clientX = e.changedTouches[0].clientX;\n        clientY = e.changedTouches[0].clientY;\n      }\n\n      // return mouse/touch position inside canvas\n      return {\n        x: clientX - rect.left,\n        y: clientY - rect.top\n      };\n    };\n\n    _this.handlePointerMove = function (x, y) {\n      if (_this.props.disabled) return;\n\n      _this.lazy.update({ x: x, y: y });\n      var isDisabled = !_this.lazy.isEnabled();\n\n      if (_this.isPressing && !_this.isDrawing || isDisabled && _this.isPressing) {\n        // Start drawing and add point\n        _this.isDrawing = true;\n        _this.points.push(_this.lazy.brush.toObject());\n      }\n\n      if (_this.isDrawing) {\n        // Add new point\n        _this.points.push(_this.lazy.brush.toObject());\n\n        // Draw current points\n        _this.drawPoints({\n          points: _this.points,\n          brushColor: _this.props.brushColor,\n          brushRadius: _this.props.brushRadius\n        });\n      }\n\n      _this.mouseHasMoved = true;\n    };\n\n    _this.drawPoints = function (_ref3) {\n      var points = _ref3.points,\n          brushColor = _ref3.brushColor,\n          brushRadius = _ref3.brushRadius;\n\n      _this.ctx.temp.lineJoin = \"round\";\n      _this.ctx.temp.lineCap = \"round\";\n      _this.ctx.temp.strokeStyle = brushColor;\n\n      _this.ctx.temp.clearRect(0, 0, _this.ctx.temp.canvas.width, _this.ctx.temp.canvas.height);\n      _this.ctx.temp.lineWidth = brushRadius * 2;\n\n      var p1 = points[0];\n      var p2 = points[1];\n\n      _this.ctx.temp.moveTo(p2.x, p2.y);\n      _this.ctx.temp.beginPath();\n\n      for (var i = 1, len = points.length; i < len; i++) {\n        // we pick the point between pi+1 & pi+2 as the\n        // end point and p1 as our control point\n        var midPoint = midPointBtw(p1, p2);\n        _this.ctx.temp.quadraticCurveTo(p1.x, p1.y, midPoint.x, midPoint.y);\n        p1 = points[i];\n        p2 = points[i + 1];\n      }\n      // Draw last line as a straight line while\n      // we wait for the next point to be able to calculate\n      // the bezier control point\n      _this.ctx.temp.lineTo(p1.x, p1.y);\n      _this.ctx.temp.stroke();\n    };\n\n    _this.saveLine = function () {\n      var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n          brushColor = _ref4.brushColor,\n          brushRadius = _ref4.brushRadius,\n          callChange = _ref4.callChange;\n\n      if (_this.points.length < 2) return;\n\n      // Save as new line\n      _this.lines.push({\n        points: [].concat(_this.points),\n        brushColor: brushColor || _this.props.brushColor,\n        brushRadius: brushRadius || _this.props.brushRadius\n      });\n\n      // Reset points array\n      _this.points.length = 0;\n\n      var width = _this.canvas.temp.width;\n      var height = _this.canvas.temp.height;\n\n      // Copy the line to the drawing canvas\n      _this.ctx.drawing.drawImage(_this.canvas.temp, 0, 0, width, height);\n\n      // Clear the temporary line-drawing canvas\n      _this.ctx.temp.clearRect(0, 0, width, height);\n\n      if (callChange) {\n        _this.triggerOnChange();\n      }\n    };\n\n    _this.triggerOnChange = function () {\n      _this.props.onChange && _this.props.onChange(_this);\n    };\n\n    _this.clear = function () {\n      _this.lines = [];\n      _this.valuesChanged = true;\n      _this.ctx.drawing.clearRect(0, 0, _this.canvas.drawing.width, _this.canvas.drawing.height);\n      _this.ctx.temp.clearRect(0, 0, _this.canvas.temp.width, _this.canvas.temp.height);\n    };\n\n    _this.loop = function () {\n      var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n          _ref5$once = _ref5.once,\n          once = _ref5$once === undefined ? false : _ref5$once;\n\n      if (_this.mouseHasMoved || _this.valuesChanged) {\n        var pointer = _this.lazy.getPointerCoordinates();\n        var brush = _this.lazy.getBrushCoordinates();\n\n        _this.drawInterface(_this.ctx.interface, pointer, brush);\n        _this.mouseHasMoved = false;\n        _this.valuesChanged = false;\n      }\n\n      if (!once) {\n        window.requestAnimationFrame(function () {\n          _this.loop();\n        });\n      }\n    };\n\n    _this.drawGrid = function (ctx) {\n      if (_this.props.hideGrid) return;\n\n      ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n\n      ctx.beginPath();\n      ctx.setLineDash([5, 1]);\n      ctx.setLineDash([]);\n      ctx.strokeStyle = _this.props.gridColor;\n      ctx.lineWidth = _this.props.gridLineWidth;\n\n      if (!_this.props.hideGridX) {\n        var countX = 0;\n        var gridSizeX = _this.props.gridSizeX;\n        while (countX < ctx.canvas.width) {\n          countX += gridSizeX;\n          ctx.moveTo(countX, 0);\n          ctx.lineTo(countX, ctx.canvas.height);\n        }\n        ctx.stroke();\n      }\n\n      if (!_this.props.hideGridY) {\n        var countY = 0;\n        var gridSizeY = _this.props.gridSizeY;\n        while (countY < ctx.canvas.height) {\n          countY += gridSizeY;\n          ctx.moveTo(0, countY);\n          ctx.lineTo(ctx.canvas.width, countY);\n        }\n        ctx.stroke();\n      }\n    };\n\n    _this.drawInterface = function (ctx, pointer, brush) {\n      if (_this.props.hideInterface) return;\n\n      ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n\n      // Draw brush preview\n      ctx.beginPath();\n      ctx.fillStyle = _this.props.brushColor;\n      ctx.arc(brush.x, brush.y, _this.props.brushRadius, 0, Math.PI * 2, true);\n      ctx.fill();\n\n      // Draw mouse point (the one directly at the cursor)\n      ctx.beginPath();\n      ctx.fillStyle = _this.props.catenaryColor;\n      ctx.arc(pointer.x, pointer.y, 4, 0, Math.PI * 2, true);\n      ctx.fill();\n\n      // Draw catenary\n      if (_this.lazy.isEnabled()) {\n        ctx.beginPath();\n        ctx.lineWidth = 2;\n        ctx.lineCap = \"round\";\n        ctx.setLineDash([2, 4]);\n        ctx.strokeStyle = _this.props.catenaryColor;\n        _this.catenary.drawToCanvas(_this.ctx.interface, brush, pointer, _this.chainLength);\n        ctx.stroke();\n      }\n\n      // Draw brush point (the one in the middle of the brush preview)\n      ctx.beginPath();\n      ctx.fillStyle = _this.props.catenaryColor;\n      ctx.arc(brush.x, brush.y, 2, 0, Math.PI * 2, true);\n      ctx.fill();\n    };\n\n    _this.canvas = {};\n    _this.ctx = {};\n\n    _this.catenary = new _catenaryCurve.Catenary();\n\n    _this.points = [];\n    _this.lines = [];\n\n    _this.mouseHasMoved = true;\n    _this.valuesChanged = true;\n    _this.isDrawing = false;\n    _this.isPressing = false;\n    return _this;\n  }\n\n  _default.prototype.componentDidMount = function componentDidMount() {\n    var _this2 = this;\n\n    this.lazy = new _lazyBrush.LazyBrush({\n      radius: this.props.lazyRadius * window.devicePixelRatio,\n      enabled: true,\n      initialPoint: {\n        x: window.innerWidth / 2,\n        y: window.innerHeight / 2\n      }\n    });\n    this.chainLength = this.props.lazyRadius * window.devicePixelRatio;\n\n    this.canvasObserver = new _resizeObserverPolyfill2.default(function (entries, observer) {\n      return _this2.handleCanvasResize(entries, observer);\n    });\n    this.canvasObserver.observe(this.canvasContainer);\n\n    this.drawImage();\n    this.loop();\n\n    window.setTimeout(function () {\n      var initX = window.innerWidth / 2;\n      var initY = window.innerHeight / 2;\n      _this2.lazy.update({ x: initX - _this2.chainLength / 4, y: initY }, { both: true });\n      _this2.lazy.update({ x: initX + _this2.chainLength / 4, y: initY }, { both: false });\n      _this2.mouseHasMoved = true;\n      _this2.valuesChanged = true;\n      _this2.clear();\n\n      // Load saveData from prop if it exists\n      if (_this2.props.saveData) {\n        _this2.loadSaveData(_this2.props.saveData);\n      }\n    }, 100);\n  };\n\n  _default.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {\n    if (prevProps.lazyRadius !== this.props.lazyRadius) {\n      // Set new lazyRadius values\n      this.chainLength = this.props.lazyRadius * window.devicePixelRatio;\n      this.lazy.setRadius(this.props.lazyRadius * window.devicePixelRatio);\n    }\n\n    if (prevProps.saveData !== this.props.saveData) {\n      this.loadSaveData(this.props.saveData);\n    }\n\n    if (JSON.stringify(prevProps) !== JSON.stringify(this.props)) {\n      // Signal this.loop function that values changed\n      this.valuesChanged = true;\n    }\n  };\n\n  _default.prototype.render = function render() {\n    var _this3 = this;\n\n    return _react2.default.createElement(\n      \"div\",\n      {\n        className: this.props.className,\n        style: _extends({\n          display: \"block\",\n          background: this.props.backgroundColor,\n          touchAction: \"none\",\n          width: this.props.canvasWidth,\n          height: this.props.canvasHeight\n        }, this.props.style),\n        ref: function ref(container) {\n          if (container) {\n            _this3.canvasContainer = container;\n          }\n        }\n      },\n      canvasTypes.map(function (_ref6) {\n        var name = _ref6.name,\n            zIndex = _ref6.zIndex;\n\n        var isInterface = name === \"interface\";\n        return _react2.default.createElement(\"canvas\", {\n          key: name,\n          ref: function ref(canvas) {\n            if (canvas) {\n              _this3.canvas[name] = canvas;\n              _this3.ctx[name] = canvas.getContext(\"2d\");\n            }\n          },\n          style: _extends({}, canvasStyle, { zIndex: zIndex }),\n          onMouseDown: isInterface ? _this3.handleDrawStart : undefined,\n          onMouseMove: isInterface ? _this3.handleDrawMove : undefined,\n          onMouseUp: isInterface ? _this3.handleDrawEnd : undefined,\n          onMouseOut: isInterface ? _this3.handleDrawEnd : undefined,\n          onTouchStart: isInterface ? _this3.handleDrawStart : undefined,\n          onTouchMove: isInterface ? _this3.handleDrawMove : undefined,\n          onTouchEnd: isInterface ? _this3.handleDrawEnd : undefined,\n          onTouchCancel: isInterface ? _this3.handleDrawEnd : undefined\n        });\n      })\n    );\n  };\n\n  return _default;\n}(_react.PureComponent), _class.propTypes = {\n  onChange: _propTypes2.default.func,\n  loadTimeOffset: _propTypes2.default.number,\n  lazyRadius: _propTypes2.default.number,\n  brushRadius: _propTypes2.default.number,\n  brushColor: _propTypes2.default.string,\n  catenaryColor: _propTypes2.default.string,\n  gridColor: _propTypes2.default.string,\n  backgroundColor: _propTypes2.default.string,\n  hideGrid: _propTypes2.default.bool,\n  canvasWidth: dimensionsPropTypes,\n  canvasHeight: dimensionsPropTypes,\n  disabled: _propTypes2.default.bool,\n  imgSrc: _propTypes2.default.string,\n  saveData: _propTypes2.default.string,\n  immediateLoading: _propTypes2.default.bool,\n  hideInterface: _propTypes2.default.bool,\n  gridSizeX: _propTypes2.default.number,\n  gridSizeY: _propTypes2.default.number,\n  gridLineWidth: _propTypes2.default.number,\n  hideGridX: _propTypes2.default.bool,\n  hideGridY: _propTypes2.default.bool\n}, _class.defaultProps = {\n  onChange: null,\n  loadTimeOffset: 5,\n  lazyRadius: 12,\n  brushRadius: 10,\n  brushColor: \"#444\",\n  catenaryColor: \"#0a0302\",\n  gridColor: \"rgba(150,150,150,0.17)\",\n  backgroundColor: \"#FFF\",\n  hideGrid: false,\n  canvasWidth: 400,\n  canvasHeight: 400,\n  disabled: false,\n  imgSrc: \"\",\n  saveData: \"\",\n  immediateLoading: false,\n  hideInterface: false,\n  gridSizeX: 25,\n  gridSizeY: 25,\n  gridLineWidth: 0.5,\n  hideGridX: false,\n  hideGridY: false\n}, _temp);\n\nexports.default = _default;\nmodule.exports = exports[\"default\"];"]}