redhotmagma-graphics-editor 1.51.1 → 1.51.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.js +76 -81
- package/CanvasAdapters/Mock/Canvas.js +54 -62
- package/CanvasAdapters/Mock/Objects/CanvasObject.js +15 -17
- package/CanvasAdapters/Mock/Objects/Group.js +21 -23
- package/CanvasAdapters/Mock/Objects/Image.js +21 -23
- package/CanvasAdapters/Mock/Objects/Text.js +22 -24
- package/CanvasAdapters/PaperJs/Canvas.js +144 -164
- package/CanvasAdapters/PaperJs/Objects/CanvasObject.js +24 -25
- package/CanvasAdapters/PaperJs/Objects/Group.js +22 -24
- package/CanvasAdapters/PaperJs/Objects/Image.js +56 -62
- package/CanvasAdapters/PaperJs/Objects/Text.js +35 -36
- package/CanvasAdapters/PaperJs/Utils/HTML2Paper.js +11 -12
- package/CanvasAdapters/PaperJs/Utils/SVGfix.js +5 -5
- package/CanvasAdapters/PaperJs/Utils/StyleParams.js +3 -3
- package/CanvasAdapters/PaperJs/Utils/TextToSVGRepository.js +26 -27
- package/CanvasAdapters/PaperJs/Utils/UseColorLayer.js +1 -1
- package/CanvasAdapters/PaperJs/Utils/UseMask.js +49 -55
- package/CanvasInterface/Canvas.js +56 -61
- package/CanvasInterface/CanvasProvider.js +22 -24
- package/CanvasInterface/Objects/CanvasObject.js +16 -19
- package/CanvasInterface/Observable.js +10 -11
- package/CanvasInterface/canvasConnect.js +21 -23
- package/CanvasInterface/index.js +1 -2
- package/Components/Canvas/Canvas.js +20 -22
- package/Components/Canvas/CanvasContainer.js +1 -1
- package/Components/DelayedContainer.js +19 -21
- package/Components/Editor/Editor.js +19 -20
- package/Components/Editor/EditorContainer.js +30 -32
- package/Components/InlineToolbox/InlineToolbox.js +40 -42
- package/Components/InlineToolbox/InlineToolboxButton.js +7 -7
- package/Components/ManipulableContainer.js +20 -22
- package/Components/ResizeDetect/ResizeDetect.js +20 -22
- package/Components/Rulers/Ruler.js +22 -25
- package/Components/Rulers/Rulers.js +17 -19
- package/Components/SelectionToolbox/ColorPalette.js +20 -23
- package/Components/SelectionToolbox/SelectionToolbox.js +25 -26
- package/Components/SelectionToolbox/TextTools.js +29 -31
- package/Components/StandardToolbox/StandardToolbox.js +63 -65
- package/Components/TextEditor/TextEditor.js +39 -41
- package/Components/TextEditor/TextEditorStateProvider.js +19 -21
- package/Components/Toolbox/ToolboxContainer.js +4 -4
- package/Components/Toolbox/ToolboxRow.js +4 -4
- package/Utils/DOM.js +7 -7
- package/Utils/Device.js +1 -1
- package/Utils/Logger.js +7 -8
- package/Utils/Range.js +1 -1
- package/_demos/UsingExternalControls/App.js +18 -20
- package/_demos/UsingRenderProps/App.js +21 -23
- package/index.js +4 -2
- package/package.json +1 -1
|
@@ -5,43 +5,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
9
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
11
|
-
function _classCallCheck(
|
|
12
|
-
function _defineProperties(
|
|
13
|
-
function _createClass(
|
|
14
|
-
function
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function _defineProperty(
|
|
22
|
-
function _toPropertyKey(
|
|
23
|
-
function _toPrimitive(
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
12
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
13
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
14
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
15
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
16
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
19
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
20
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
24
|
var ManipulableContainer = exports["default"] = /*#__PURE__*/function (_React$Component) {
|
|
25
|
-
_inherits(ManipulableContainer, _React$Component);
|
|
26
|
-
var _super = _createSuper(ManipulableContainer);
|
|
27
25
|
function ManipulableContainer() {
|
|
28
26
|
var _this;
|
|
29
27
|
_classCallCheck(this, ManipulableContainer);
|
|
30
28
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
29
|
args[_key] = arguments[_key];
|
|
32
30
|
}
|
|
33
|
-
_this =
|
|
34
|
-
_defineProperty(
|
|
31
|
+
_this = _callSuper(this, ManipulableContainer, [].concat(args));
|
|
32
|
+
_defineProperty(_this, "transform", {
|
|
35
33
|
translate: {
|
|
36
34
|
x: 0,
|
|
37
35
|
y: 0
|
|
38
36
|
},
|
|
39
37
|
rotate: 0
|
|
40
38
|
});
|
|
41
|
-
_defineProperty(
|
|
39
|
+
_defineProperty(_this, "containerRef", /*#__PURE__*/_react["default"].createRef());
|
|
42
40
|
return _this;
|
|
43
41
|
}
|
|
44
|
-
|
|
42
|
+
_inherits(ManipulableContainer, _React$Component);
|
|
43
|
+
return _createClass(ManipulableContainer, [{
|
|
45
44
|
key: "translate",
|
|
46
45
|
value: function translate(_ref) {
|
|
47
46
|
var x = _ref.x,
|
|
@@ -75,5 +74,4 @@ var ManipulableContainer = exports["default"] = /*#__PURE__*/function (_React$Co
|
|
|
75
74
|
}, this.props));
|
|
76
75
|
}
|
|
77
76
|
}]);
|
|
78
|
-
return ManipulableContainer;
|
|
79
77
|
}(_react["default"].Component);
|
|
@@ -8,33 +8,31 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _cssElementQueries = require("css-element-queries");
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
11
|
-
function _interopRequireDefault(
|
|
12
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
13
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
14
|
-
function _classCallCheck(
|
|
15
|
-
function _defineProperties(
|
|
16
|
-
function _createClass(
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
function _defineProperty(
|
|
25
|
-
function _toPropertyKey(
|
|
26
|
-
function _toPrimitive(
|
|
14
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
15
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
16
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
17
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
18
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
19
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
20
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
22
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
23
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
24
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
25
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
26
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
27
|
var ResizeDetect = exports["default"] = /*#__PURE__*/function (_React$Component) {
|
|
28
|
-
_inherits(ResizeDetect, _React$Component);
|
|
29
|
-
var _super = _createSuper(ResizeDetect);
|
|
30
28
|
function ResizeDetect() {
|
|
31
29
|
var _this;
|
|
32
30
|
_classCallCheck(this, ResizeDetect);
|
|
33
31
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
32
|
args[_key] = arguments[_key];
|
|
35
33
|
}
|
|
36
|
-
_this =
|
|
37
|
-
_defineProperty(
|
|
34
|
+
_this = _callSuper(this, ResizeDetect, [].concat(args));
|
|
35
|
+
_defineProperty(_this, "onSizeChange", function () {
|
|
38
36
|
if (_this.props.onSizeChange) {
|
|
39
37
|
var container = _this.containerRef.current;
|
|
40
38
|
var _container$getBoundin = container.getBoundingClientRect(),
|
|
@@ -46,10 +44,11 @@ var ResizeDetect = exports["default"] = /*#__PURE__*/function (_React$Component)
|
|
|
46
44
|
});
|
|
47
45
|
}
|
|
48
46
|
});
|
|
49
|
-
_defineProperty(
|
|
47
|
+
_defineProperty(_this, "containerRef", /*#__PURE__*/_react["default"].createRef());
|
|
50
48
|
return _this;
|
|
51
49
|
}
|
|
52
|
-
|
|
50
|
+
_inherits(ResizeDetect, _React$Component);
|
|
51
|
+
return _createClass(ResizeDetect, [{
|
|
53
52
|
key: "componentDidMount",
|
|
54
53
|
value: function componentDidMount() {
|
|
55
54
|
var container = this.containerRef.current;
|
|
@@ -76,7 +75,6 @@ var ResizeDetect = exports["default"] = /*#__PURE__*/function (_React$Component)
|
|
|
76
75
|
}));
|
|
77
76
|
}
|
|
78
77
|
}]);
|
|
79
|
-
return ResizeDetect;
|
|
80
78
|
}(_react["default"].Component);
|
|
81
79
|
_defineProperty(ResizeDetect, "propTypes", {
|
|
82
80
|
onSizeChange: _propTypes["default"].func,
|
|
@@ -9,21 +9,21 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _withStyles = _interopRequireDefault(require("@material-ui/core/styles/withStyles"));
|
|
10
10
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
11
11
|
var _EditorContainer = require("../Editor/EditorContainer");
|
|
12
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
13
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
14
|
-
function _classCallCheck(
|
|
15
|
-
function _defineProperties(
|
|
16
|
-
function _createClass(
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
function _defineProperty(
|
|
25
|
-
function _toPropertyKey(
|
|
26
|
-
function _toPrimitive(
|
|
14
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
15
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
16
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
17
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
18
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
19
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
20
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
22
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
23
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
24
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
25
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
26
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
27
|
var TYPE_TOP = 'top';
|
|
28
28
|
var TYPE_RIGHT = 'right';
|
|
29
29
|
var TYPE_BOTTOM = 'bottom';
|
|
@@ -32,17 +32,15 @@ var LINE_TYPE_1 = 'LINE_TYPE_1';
|
|
|
32
32
|
var LINE_TYPE_2 = 'LINE_TYPE_2';
|
|
33
33
|
var LINE_TYPE_3 = 'LINE_TYPE_3';
|
|
34
34
|
var Ruler = /*#__PURE__*/function (_React$Component) {
|
|
35
|
-
_inherits(Ruler, _React$Component);
|
|
36
|
-
var _super = _createSuper(Ruler);
|
|
37
35
|
function Ruler(props) {
|
|
38
36
|
var _this;
|
|
39
37
|
_classCallCheck(this, Ruler);
|
|
40
|
-
_this =
|
|
41
|
-
_defineProperty(
|
|
38
|
+
_this = _callSuper(this, Ruler, [props]);
|
|
39
|
+
_defineProperty(_this, "getMmInPixel", function (totalWidthMm, totalWidthPx, alignRight, mm) {
|
|
42
40
|
var result = Math.round(mm / totalWidthMm * totalWidthPx);
|
|
43
41
|
return alignRight ? totalWidthPx - result : result;
|
|
44
42
|
});
|
|
45
|
-
_defineProperty(
|
|
43
|
+
_defineProperty(_this, "drawUnitLine", function (ctx, widthMm, widthPx, heightPx, alignRight, mm, lineType) {
|
|
46
44
|
var lineHeight = heightPx;
|
|
47
45
|
if (lineType === LINE_TYPE_1) {
|
|
48
46
|
lineHeight = Math.round(heightPx / 3);
|
|
@@ -55,7 +53,7 @@ var Ruler = /*#__PURE__*/function (_React$Component) {
|
|
|
55
53
|
ctx.lineTo(x, heightPx - lineHeight);
|
|
56
54
|
ctx.stroke();
|
|
57
55
|
});
|
|
58
|
-
_defineProperty(
|
|
56
|
+
_defineProperty(_this, "drawUnitText", function (ctx, widthMm, widthPx, heightPx, alignRight, rotate, mm) {
|
|
59
57
|
var fontSize = 10;
|
|
60
58
|
var paddingTop = 2;
|
|
61
59
|
var paddingSide = 2;
|
|
@@ -76,7 +74,7 @@ var Ruler = /*#__PURE__*/function (_React$Component) {
|
|
|
76
74
|
ctx.fillText("".concat(mm, " mm"), x + paddingSide * (alignRight ? 1 : -1), paddingTop);
|
|
77
75
|
}
|
|
78
76
|
});
|
|
79
|
-
_defineProperty(
|
|
77
|
+
_defineProperty(_this, "updateCanvas", function () {
|
|
80
78
|
var prevProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
81
79
|
var _this$props = _this.props,
|
|
82
80
|
type = _this$props.type,
|
|
@@ -125,7 +123,8 @@ var Ruler = /*#__PURE__*/function (_React$Component) {
|
|
|
125
123
|
_this.canvas = /*#__PURE__*/_react["default"].createRef();
|
|
126
124
|
return _this;
|
|
127
125
|
}
|
|
128
|
-
|
|
126
|
+
_inherits(Ruler, _React$Component);
|
|
127
|
+
return _createClass(Ruler, [{
|
|
129
128
|
key: "componentDidMount",
|
|
130
129
|
value: function componentDidMount() {
|
|
131
130
|
this.updateCanvas();
|
|
@@ -138,18 +137,16 @@ var Ruler = /*#__PURE__*/function (_React$Component) {
|
|
|
138
137
|
}, {
|
|
139
138
|
key: "render",
|
|
140
139
|
value: function render() {
|
|
141
|
-
var _classMap;
|
|
142
140
|
var _this$props2 = this.props,
|
|
143
141
|
classes = _this$props2.classes,
|
|
144
142
|
type = _this$props2.type;
|
|
145
|
-
var classMap = (
|
|
143
|
+
var classMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, TYPE_TOP, "".concat(classes.ruler, " ").concat(classes.rulerTop)), TYPE_RIGHT, "".concat(classes.ruler, " ").concat(classes.rulerRight)), TYPE_BOTTOM, "".concat(classes.ruler, " ").concat(classes.rulerBottom)), TYPE_LEFT, "".concat(classes.ruler, " ").concat(classes.rulerLeft));
|
|
146
144
|
return /*#__PURE__*/_react["default"].createElement("canvas", {
|
|
147
145
|
ref: this.canvas,
|
|
148
146
|
className: classMap[type]
|
|
149
147
|
});
|
|
150
148
|
}
|
|
151
149
|
}]);
|
|
152
|
-
return Ruler;
|
|
153
150
|
}(_react["default"].Component);
|
|
154
151
|
_defineProperty(Ruler, "propTypes", {
|
|
155
152
|
classes: _propTypes["default"].object.isRequired,
|
|
@@ -12,30 +12,29 @@ var _Canvas = require("../../CanvasInterface/Canvas");
|
|
|
12
12
|
var _Logger = _interopRequireDefault(require("../../Utils/Logger"));
|
|
13
13
|
var _Ruler = _interopRequireDefault(require("./Ruler"));
|
|
14
14
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
15
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
16
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
17
|
-
function _classCallCheck(
|
|
18
|
-
function _defineProperties(
|
|
19
|
-
function _createClass(
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
function
|
|
25
|
-
function
|
|
26
|
-
function
|
|
27
|
-
function _defineProperty(
|
|
28
|
-
function _toPropertyKey(
|
|
29
|
-
function _toPrimitive(
|
|
17
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
18
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
19
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
20
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
21
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
22
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
23
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
24
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
25
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
26
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
27
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
28
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
29
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
30
30
|
var logger = new _Logger["default"]('Rulers');
|
|
31
31
|
var Rulers = /*#__PURE__*/function (_React$Component) {
|
|
32
|
-
_inherits(Rulers, _React$Component);
|
|
33
|
-
var _super = _createSuper(Rulers);
|
|
34
32
|
function Rulers() {
|
|
35
33
|
_classCallCheck(this, Rulers);
|
|
36
|
-
return
|
|
34
|
+
return _callSuper(this, Rulers, arguments);
|
|
37
35
|
}
|
|
38
|
-
|
|
36
|
+
_inherits(Rulers, _React$Component);
|
|
37
|
+
return _createClass(Rulers, [{
|
|
39
38
|
key: "render",
|
|
40
39
|
value: function render() {
|
|
41
40
|
logger.log('render Rulers');
|
|
@@ -53,7 +52,6 @@ var Rulers = /*#__PURE__*/function (_React$Component) {
|
|
|
53
52
|
}));
|
|
54
53
|
}
|
|
55
54
|
}]);
|
|
56
|
-
return Rulers;
|
|
57
55
|
}(_react["default"].Component);
|
|
58
56
|
_defineProperty(Rulers, "propTypes", {
|
|
59
57
|
canvas: _propTypes["default"].instanceOf(_Canvas.AbstractCanvas).isRequired,
|
|
@@ -8,21 +8,21 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _withStyles = _interopRequireDefault(require("@material-ui/core/styles/withStyles"));
|
|
9
9
|
var _isObject = _interopRequireDefault(require("lodash/isObject"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
function _interopRequireDefault(
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
12
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
13
|
-
function
|
|
14
|
-
function
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function _classCallCheck(
|
|
21
|
-
function _defineProperties(
|
|
22
|
-
function _createClass(
|
|
23
|
-
function _defineProperty(
|
|
24
|
-
function _toPropertyKey(
|
|
25
|
-
function _toPrimitive(
|
|
13
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
15
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
16
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
18
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
19
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
20
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
21
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
22
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
23
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
26
|
var Color = /*#__PURE__*/function () {
|
|
27
27
|
function Color(r, g, b) {
|
|
28
28
|
_classCallCheck(this, Color);
|
|
@@ -39,7 +39,7 @@ var Color = /*#__PURE__*/function () {
|
|
|
39
39
|
};
|
|
40
40
|
this.identifier = this.hex;
|
|
41
41
|
}
|
|
42
|
-
_createClass(Color, [{
|
|
42
|
+
return _createClass(Color, [{
|
|
43
43
|
key: "hex",
|
|
44
44
|
get: function get() {
|
|
45
45
|
return Color.rgb2hex(this.rgb);
|
|
@@ -97,7 +97,6 @@ var Color = /*#__PURE__*/function () {
|
|
|
97
97
|
} : null;
|
|
98
98
|
}
|
|
99
99
|
}]);
|
|
100
|
-
return Color;
|
|
101
100
|
}();
|
|
102
101
|
function generatePalette() {
|
|
103
102
|
var numColors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
@@ -148,19 +147,17 @@ var styles = {
|
|
|
148
147
|
}
|
|
149
148
|
};
|
|
150
149
|
var ColorPalette = /*#__PURE__*/function (_React$Component) {
|
|
151
|
-
_inherits(ColorPalette, _React$Component);
|
|
152
|
-
var _super = _createSuper(ColorPalette);
|
|
153
150
|
function ColorPalette() {
|
|
154
151
|
var _this;
|
|
155
152
|
_classCallCheck(this, ColorPalette);
|
|
156
153
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
157
154
|
args[_key] = arguments[_key];
|
|
158
155
|
}
|
|
159
|
-
_this =
|
|
160
|
-
_defineProperty(
|
|
156
|
+
_this = _callSuper(this, ColorPalette, [].concat(args));
|
|
157
|
+
_defineProperty(_this, "state", {
|
|
161
158
|
show: false
|
|
162
159
|
});
|
|
163
|
-
_defineProperty(
|
|
160
|
+
_defineProperty(_this, "toggle", function () {
|
|
164
161
|
return _this.setState(function (_ref3) {
|
|
165
162
|
var show = _ref3.show;
|
|
166
163
|
return {
|
|
@@ -170,7 +167,8 @@ var ColorPalette = /*#__PURE__*/function (_React$Component) {
|
|
|
170
167
|
});
|
|
171
168
|
return _this;
|
|
172
169
|
}
|
|
173
|
-
|
|
170
|
+
_inherits(ColorPalette, _React$Component);
|
|
171
|
+
return _createClass(ColorPalette, [{
|
|
174
172
|
key: "render",
|
|
175
173
|
value: function render() {
|
|
176
174
|
var _this$props = this.props,
|
|
@@ -217,7 +215,6 @@ var ColorPalette = /*#__PURE__*/function (_React$Component) {
|
|
|
217
215
|
})));
|
|
218
216
|
}
|
|
219
217
|
}]);
|
|
220
|
-
return ColorPalette;
|
|
221
218
|
}(_react["default"].Component);
|
|
222
219
|
_defineProperty(ColorPalette, "propTypes", {
|
|
223
220
|
palette: _propTypes["default"].object,
|