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,38 +5,37 @@ 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 _classCallCheck(
|
|
11
|
-
function _defineProperties(
|
|
12
|
-
function _createClass(
|
|
13
|
-
function
|
|
14
|
-
function
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function _defineProperty(
|
|
21
|
-
function _toPropertyKey(
|
|
22
|
-
function _toPrimitive(
|
|
10
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
|
+
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); } }
|
|
12
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
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 _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; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
|
+
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); }
|
|
23
23
|
var DelayedContainer = exports["default"] = /*#__PURE__*/function (_React$Component) {
|
|
24
|
-
_inherits(DelayedContainer, _React$Component);
|
|
25
|
-
var _super = _createSuper(DelayedContainer);
|
|
26
24
|
function DelayedContainer() {
|
|
27
25
|
var _this;
|
|
28
26
|
_classCallCheck(this, DelayedContainer);
|
|
29
27
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
28
|
args[_key] = arguments[_key];
|
|
31
29
|
}
|
|
32
|
-
_this =
|
|
33
|
-
_defineProperty(
|
|
30
|
+
_this = _callSuper(this, DelayedContainer, [].concat(args));
|
|
31
|
+
_defineProperty(_this, "state", {
|
|
34
32
|
mounted: false
|
|
35
33
|
});
|
|
36
|
-
_defineProperty(
|
|
34
|
+
_defineProperty(_this, "wrapperRef", /*#__PURE__*/_react["default"].createRef());
|
|
37
35
|
return _this;
|
|
38
36
|
}
|
|
39
|
-
|
|
37
|
+
_inherits(DelayedContainer, _React$Component);
|
|
38
|
+
return _createClass(DelayedContainer, [{
|
|
40
39
|
key: "componentDidMount",
|
|
41
40
|
value: function componentDidMount() {
|
|
42
41
|
this.setState({
|
|
@@ -58,5 +57,4 @@ var DelayedContainer = exports["default"] = /*#__PURE__*/function (_React$Compon
|
|
|
58
57
|
}) || this.props.children));
|
|
59
58
|
}
|
|
60
59
|
}]);
|
|
61
|
-
return DelayedContainer;
|
|
62
60
|
}(_react["default"].Component);
|
|
@@ -18,35 +18,35 @@ var _SelectionToolbox = _interopRequireDefault(require("../SelectionToolbox/Sele
|
|
|
18
18
|
var _Rulers = _interopRequireDefault(require("../Rulers/Rulers"));
|
|
19
19
|
var _EditorContainer = _interopRequireDefault(require("./EditorContainer"));
|
|
20
20
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
21
|
-
function _interopRequireDefault(
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
22
22
|
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); }
|
|
23
|
-
function
|
|
24
|
-
function
|
|
25
|
-
function
|
|
26
|
-
function
|
|
27
|
-
function
|
|
28
|
-
function
|
|
29
|
-
function
|
|
30
|
-
function
|
|
31
|
-
function
|
|
32
|
-
function
|
|
33
|
-
function
|
|
34
|
-
function
|
|
35
|
-
function
|
|
23
|
+
function _readOnlyError(r) { throw new TypeError('"' + r + '" is read-only'); }
|
|
24
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
25
|
+
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); } }
|
|
26
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
27
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
28
|
+
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); }
|
|
29
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
30
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
31
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
32
|
+
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); }
|
|
33
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
34
|
+
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; }
|
|
35
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
36
|
+
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); }
|
|
36
37
|
var Editor = exports.Editor = /*#__PURE__*/function (_React$Component) {
|
|
37
|
-
_inherits(Editor, _React$Component);
|
|
38
|
-
var _super = _createSuper(Editor);
|
|
39
38
|
function Editor() {
|
|
40
39
|
var _this;
|
|
41
40
|
_classCallCheck(this, Editor);
|
|
42
41
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
43
42
|
args[_key] = arguments[_key];
|
|
44
43
|
}
|
|
45
|
-
_this =
|
|
46
|
-
_defineProperty(
|
|
44
|
+
_this = _callSuper(this, Editor, [].concat(args));
|
|
45
|
+
_defineProperty(_this, "canvasElementRef", /*#__PURE__*/_react["default"].createRef());
|
|
47
46
|
return _this;
|
|
48
47
|
}
|
|
49
|
-
|
|
48
|
+
_inherits(Editor, _React$Component);
|
|
49
|
+
return _createClass(Editor, [{
|
|
50
50
|
key: "componentDidMount",
|
|
51
51
|
value: function componentDidMount() {
|
|
52
52
|
var canvas = this.props.canvas;
|
|
@@ -218,7 +218,6 @@ var Editor = exports.Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
218
218
|
}));
|
|
219
219
|
}
|
|
220
220
|
}]);
|
|
221
|
-
return Editor;
|
|
222
221
|
}(_react["default"].Component);
|
|
223
222
|
_defineProperty(Editor, "propTypes", {
|
|
224
223
|
renderStandardToolbox: _propTypes["default"].func,
|
|
@@ -11,30 +11,30 @@ var _Canvas = require("../../CanvasInterface/Canvas");
|
|
|
11
11
|
var _CanvasProvider = require("../../CanvasInterface/CanvasProvider");
|
|
12
12
|
var _Logger = _interopRequireDefault(require("../../Utils/Logger"));
|
|
13
13
|
var _String = require("../../Utils/String");
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
15
|
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); }
|
|
16
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
16
|
+
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); }
|
|
17
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
-
function _toConsumableArray(
|
|
19
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
20
20
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
|
-
function _unsupportedIterableToArray(
|
|
22
|
-
function _iterableToArray(
|
|
23
|
-
function _arrayWithoutHoles(
|
|
24
|
-
function _arrayLikeToArray(
|
|
25
|
-
function _classCallCheck(
|
|
26
|
-
function _defineProperties(
|
|
27
|
-
function _createClass(
|
|
28
|
-
function
|
|
29
|
-
function
|
|
30
|
-
function
|
|
31
|
-
function
|
|
32
|
-
function
|
|
33
|
-
function
|
|
34
|
-
function
|
|
35
|
-
function _defineProperty(
|
|
36
|
-
function _toPropertyKey(
|
|
37
|
-
function _toPrimitive(
|
|
21
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
22
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
23
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
24
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
25
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
26
|
+
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); } }
|
|
27
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
28
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
29
|
+
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); }
|
|
30
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
31
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
32
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
33
|
+
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); }
|
|
34
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
35
|
+
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; }
|
|
36
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
37
|
+
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); }
|
|
38
38
|
var logger = new _Logger["default"]('EditorContainer');
|
|
39
39
|
var initialState = {
|
|
40
40
|
canvasPosition: {
|
|
@@ -50,28 +50,26 @@ var initialState = {
|
|
|
50
50
|
};
|
|
51
51
|
var CanvasPositionContext = exports.CanvasPositionContext = /*#__PURE__*/_react["default"].createContext(initialState);
|
|
52
52
|
var EditorContainer = exports.EditorContainer = /*#__PURE__*/function (_React$Component) {
|
|
53
|
-
_inherits(EditorContainer, _React$Component);
|
|
54
|
-
var _super = _createSuper(EditorContainer);
|
|
55
53
|
function EditorContainer() {
|
|
56
54
|
var _this;
|
|
57
55
|
_classCallCheck(this, EditorContainer);
|
|
58
56
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
59
57
|
args[_key] = arguments[_key];
|
|
60
58
|
}
|
|
61
|
-
_this =
|
|
62
|
-
_defineProperty(
|
|
63
|
-
_defineProperty(
|
|
64
|
-
_defineProperty(
|
|
59
|
+
_this = _callSuper(this, EditorContainer, [].concat(args));
|
|
60
|
+
_defineProperty(_this, "state", initialState);
|
|
61
|
+
_defineProperty(_this, "resizeSensor", null);
|
|
62
|
+
_defineProperty(_this, "onSizeChange", function (size) {
|
|
65
63
|
_this.setState({
|
|
66
64
|
editorSize: size
|
|
67
65
|
});
|
|
68
66
|
});
|
|
69
|
-
_defineProperty(
|
|
67
|
+
_defineProperty(_this, "onCanvasSizeChange", function () {
|
|
70
68
|
logger.log('canvas size changed, updating canvas position');
|
|
71
69
|
_this.updateCanvasPosition();
|
|
72
70
|
});
|
|
73
|
-
_defineProperty(
|
|
74
|
-
_defineProperty(
|
|
71
|
+
_defineProperty(_this, "containerRef", /*#__PURE__*/_react["default"].createRef());
|
|
72
|
+
_defineProperty(_this, "calculateSiblingsHeight", function () {
|
|
75
73
|
var element = _this.containerRef.current;
|
|
76
74
|
if (!element) {
|
|
77
75
|
return 0;
|
|
@@ -83,7 +81,7 @@ var EditorContainer = exports.EditorContainer = /*#__PURE__*/function (_React$Co
|
|
|
83
81
|
});
|
|
84
82
|
return sum;
|
|
85
83
|
});
|
|
86
|
-
_defineProperty(
|
|
84
|
+
_defineProperty(_this, "calculateContainerStyle", function () {
|
|
87
85
|
var wrapper = _this.containerRef.current && _this.containerRef.current.parentElement;
|
|
88
86
|
var _this$props = _this.props,
|
|
89
87
|
fillContainer = _this$props.fillContainer,
|
|
@@ -117,7 +115,8 @@ var EditorContainer = exports.EditorContainer = /*#__PURE__*/function (_React$Co
|
|
|
117
115
|
});
|
|
118
116
|
return _this;
|
|
119
117
|
}
|
|
120
|
-
|
|
118
|
+
_inherits(EditorContainer, _React$Component);
|
|
119
|
+
return _createClass(EditorContainer, [{
|
|
121
120
|
key: "componentDidMount",
|
|
122
121
|
value: function componentDidMount() {
|
|
123
122
|
var container = this.containerRef.current;
|
|
@@ -244,7 +243,6 @@ var EditorContainer = exports.EditorContainer = /*#__PURE__*/function (_React$Co
|
|
|
244
243
|
}, children));
|
|
245
244
|
}
|
|
246
245
|
}]);
|
|
247
|
-
return EditorContainer;
|
|
248
246
|
}(_react["default"].Component);
|
|
249
247
|
_defineProperty(EditorContainer, "propTypes", {
|
|
250
248
|
allowUpScaling: _propTypes["default"].bool,
|
|
@@ -15,36 +15,34 @@ var _CanvasProvider = require("../../CanvasInterface/CanvasProvider");
|
|
|
15
15
|
var _Canvas = require("../../CanvasInterface/Canvas");
|
|
16
16
|
var _EditorContainer = require("../Editor/EditorContainer");
|
|
17
17
|
var _Logger = _interopRequireDefault(require("../../Utils/Logger"));
|
|
18
|
-
function _interopRequireDefault(
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
19
19
|
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); }
|
|
20
|
-
function _classCallCheck(
|
|
21
|
-
function _defineProperties(
|
|
22
|
-
function _createClass(
|
|
23
|
-
function
|
|
24
|
-
function
|
|
25
|
-
function
|
|
26
|
-
function
|
|
27
|
-
function
|
|
28
|
-
function
|
|
29
|
-
function
|
|
30
|
-
function _defineProperty(
|
|
31
|
-
function _toPropertyKey(
|
|
32
|
-
function _toPrimitive(
|
|
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 _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
24
|
+
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); }
|
|
25
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
26
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
28
|
+
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); }
|
|
29
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
30
|
+
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; }
|
|
31
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
32
|
+
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); }
|
|
33
33
|
var logger = new _Logger["default"]('InlineToolbox');
|
|
34
34
|
var InlineToolBox = /*#__PURE__*/function (_React$Component) {
|
|
35
|
-
_inherits(InlineToolBox, _React$Component);
|
|
36
|
-
var _super = _createSuper(InlineToolBox);
|
|
37
35
|
function InlineToolBox() {
|
|
38
36
|
var _this;
|
|
39
37
|
_classCallCheck(this, InlineToolBox);
|
|
40
38
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
41
39
|
args[_key] = arguments[_key];
|
|
42
40
|
}
|
|
43
|
-
_this =
|
|
44
|
-
_defineProperty(
|
|
41
|
+
_this = _callSuper(this, InlineToolBox, [].concat(args));
|
|
42
|
+
_defineProperty(_this, "state", {
|
|
45
43
|
show: false
|
|
46
44
|
});
|
|
47
|
-
_defineProperty(
|
|
45
|
+
_defineProperty(_this, "getClientPositionFromEvent", function (evt) {
|
|
48
46
|
var isTouchEvent = !!evt.changedTouches;
|
|
49
47
|
return {
|
|
50
48
|
isTouchEvent: isTouchEvent,
|
|
@@ -52,7 +50,7 @@ var InlineToolBox = /*#__PURE__*/function (_React$Component) {
|
|
|
52
50
|
y: isTouchEvent ? evt.changedTouches[0].clientY : evt.clientY
|
|
53
51
|
};
|
|
54
52
|
});
|
|
55
|
-
_defineProperty(
|
|
53
|
+
_defineProperty(_this, "onScalingChange", function (evt) {
|
|
56
54
|
var selectedObject = _this.props.canvas.selectedObject;
|
|
57
55
|
if (!selectedObject) {
|
|
58
56
|
return;
|
|
@@ -80,21 +78,21 @@ var InlineToolBox = /*#__PURE__*/function (_React$Component) {
|
|
|
80
78
|
iDistance = dDistance;
|
|
81
79
|
_this.updateToolbarTransform();
|
|
82
80
|
};
|
|
83
|
-
var
|
|
81
|
+
var _mouseUp = function mouseUp(evt) {
|
|
84
82
|
selectedObject.activeAction = '';
|
|
85
83
|
var clientPosition = _this.getClientPositionFromEvent(evt);
|
|
86
84
|
evt.preventDefault();
|
|
87
85
|
document.removeEventListener(clientPosition.isTouchEvent ? 'touchmove' : 'mousemove', mouseMove, {
|
|
88
86
|
passive: false
|
|
89
87
|
});
|
|
90
|
-
document.removeEventListener(clientPosition.isTouchEvent ? 'touchend' : 'mouseup',
|
|
88
|
+
document.removeEventListener(clientPosition.isTouchEvent ? 'touchend' : 'mouseup', _mouseUp);
|
|
91
89
|
};
|
|
92
90
|
document.addEventListener(clientPosition.isTouchEvent ? 'touchmove' : 'mousemove', mouseMove, {
|
|
93
91
|
passive: false
|
|
94
92
|
});
|
|
95
|
-
document.addEventListener(clientPosition.isTouchEvent ? 'touchend' : 'mouseup',
|
|
93
|
+
document.addEventListener(clientPosition.isTouchEvent ? 'touchend' : 'mouseup', _mouseUp);
|
|
96
94
|
});
|
|
97
|
-
_defineProperty(
|
|
95
|
+
_defineProperty(_this, "onRotationChange", function (evt) {
|
|
98
96
|
var _this$props$canvas = _this.props.canvas,
|
|
99
97
|
selectedObject = _this$props$canvas.selectedObject,
|
|
100
98
|
canvasElement = _this$props$canvas.canvasElement;
|
|
@@ -121,7 +119,7 @@ var InlineToolBox = /*#__PURE__*/function (_React$Component) {
|
|
|
121
119
|
iAngle = dAngle;
|
|
122
120
|
_this.updateToolbarTransform();
|
|
123
121
|
};
|
|
124
|
-
var
|
|
122
|
+
var _mouseUp2 = function mouseUp(evt) {
|
|
125
123
|
selectedObject.activeAction = '';
|
|
126
124
|
var clientPosition = _this.getClientPositionFromEvent(evt);
|
|
127
125
|
evt.preventDefault();
|
|
@@ -130,20 +128,20 @@ var InlineToolBox = /*#__PURE__*/function (_React$Component) {
|
|
|
130
128
|
document.removeEventListener(clientPosition.isTouchEvent ? 'touchmove' : 'mousemove', mouseMove, {
|
|
131
129
|
passive: false
|
|
132
130
|
});
|
|
133
|
-
document.removeEventListener(clientPosition.isTouchEvent ? 'touchend' : 'mouseup',
|
|
131
|
+
document.removeEventListener(clientPosition.isTouchEvent ? 'touchend' : 'mouseup', _mouseUp2);
|
|
134
132
|
};
|
|
135
133
|
document.addEventListener(clientPosition.isTouchEvent ? 'touchmove' : 'mousemove', mouseMove, {
|
|
136
134
|
passive: false
|
|
137
135
|
});
|
|
138
|
-
document.addEventListener(clientPosition.isTouchEvent ? 'touchend' : 'mouseup',
|
|
136
|
+
document.addEventListener(clientPosition.isTouchEvent ? 'touchend' : 'mouseup', _mouseUp2);
|
|
139
137
|
});
|
|
140
|
-
_defineProperty(
|
|
138
|
+
_defineProperty(_this, "onDeleteClick", function () {
|
|
141
139
|
var selectedObject = _this.props.canvas.selectedObject;
|
|
142
140
|
if (selectedObject) {
|
|
143
141
|
selectedObject.remove();
|
|
144
142
|
}
|
|
145
143
|
});
|
|
146
|
-
_defineProperty(
|
|
144
|
+
_defineProperty(_this, "snapToDeg", function (valueDeg) {
|
|
147
145
|
var toleranceDeg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
|
148
146
|
var snapValues = [0, 45, 90, 135, 180, 225, 270, 315, 360];
|
|
149
147
|
var foundSnapValue = snapValues.find(function (value) {
|
|
@@ -154,20 +152,20 @@ var InlineToolBox = /*#__PURE__*/function (_React$Component) {
|
|
|
154
152
|
}
|
|
155
153
|
return foundSnapValue === 360 ? 0 : foundSnapValue;
|
|
156
154
|
});
|
|
157
|
-
_defineProperty(
|
|
158
|
-
_defineProperty(
|
|
159
|
-
_defineProperty(
|
|
160
|
-
_defineProperty(
|
|
161
|
-
_defineProperty(
|
|
162
|
-
_defineProperty(
|
|
155
|
+
_defineProperty(_this, "bottomRightContainerRef", /*#__PURE__*/_react["default"].createRef());
|
|
156
|
+
_defineProperty(_this, "topRightContainerRef", /*#__PURE__*/_react["default"].createRef());
|
|
157
|
+
_defineProperty(_this, "bottomLeftContainerRef", /*#__PURE__*/_react["default"].createRef());
|
|
158
|
+
_defineProperty(_this, "topLeftContainerRef", /*#__PURE__*/_react["default"].createRef());
|
|
159
|
+
_defineProperty(_this, "angleLabelRef", /*#__PURE__*/_react["default"].createRef());
|
|
160
|
+
_defineProperty(_this, "renderToolboxButton", function (positionName) {
|
|
163
161
|
var _this$props = _this.props,
|
|
164
162
|
renderToolboxButton = _this$props.renderToolboxButton,
|
|
165
163
|
canvas = _this$props.canvas,
|
|
166
164
|
selectedObject = _this$props.selectedObject;
|
|
167
|
-
var
|
|
168
|
-
onScalingChange =
|
|
169
|
-
onRotationChange =
|
|
170
|
-
onDeleteClick =
|
|
165
|
+
var _this2 = _this,
|
|
166
|
+
onScalingChange = _this2.onScalingChange,
|
|
167
|
+
onRotationChange = _this2.onRotationChange,
|
|
168
|
+
onDeleteClick = _this2.onDeleteClick;
|
|
171
169
|
if (renderToolboxButton) {
|
|
172
170
|
// call the render prop method with the position name and the available functions
|
|
173
171
|
return renderToolboxButton({
|
|
@@ -214,7 +212,7 @@ var InlineToolBox = /*#__PURE__*/function (_React$Component) {
|
|
|
214
212
|
return null;
|
|
215
213
|
}
|
|
216
214
|
});
|
|
217
|
-
_defineProperty(
|
|
215
|
+
_defineProperty(_this, "AngleLabel", function (_ref) {
|
|
218
216
|
var className = _ref.className,
|
|
219
217
|
renderAngleLabel = _ref.renderAngleLabel;
|
|
220
218
|
var selectedObjectInCanvas = (0, _get["default"])(_this.props, 'canvas.selectedObject', null);
|
|
@@ -227,7 +225,8 @@ var InlineToolBox = /*#__PURE__*/function (_React$Component) {
|
|
|
227
225
|
});
|
|
228
226
|
return _this;
|
|
229
227
|
}
|
|
230
|
-
|
|
228
|
+
_inherits(InlineToolBox, _React$Component);
|
|
229
|
+
return _createClass(InlineToolBox, [{
|
|
231
230
|
key: "componentDidMount",
|
|
232
231
|
value: function componentDidMount() {
|
|
233
232
|
this.initState();
|
|
@@ -385,7 +384,6 @@ var InlineToolBox = /*#__PURE__*/function (_React$Component) {
|
|
|
385
384
|
return null;
|
|
386
385
|
}
|
|
387
386
|
}]);
|
|
388
|
-
return InlineToolBox;
|
|
389
387
|
}(_react["default"].Component);
|
|
390
388
|
_defineProperty(InlineToolBox, "propTypes", {
|
|
391
389
|
children: _propTypes["default"].func,
|
|
@@ -7,15 +7,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _excluded = ["style"];
|
|
10
|
-
function _interopRequireDefault(
|
|
11
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
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); }
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
function _defineProperty(
|
|
15
|
-
function _toPropertyKey(
|
|
16
|
-
function _toPrimitive(
|
|
17
|
-
function _objectWithoutProperties(
|
|
18
|
-
function _objectWithoutPropertiesLoose(
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
|
+
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); }
|
|
17
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
18
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
19
19
|
var InlineToolboxButton = function InlineToolboxButton(_ref) {
|
|
20
20
|
var style = _ref.style,
|
|
21
21
|
props = _objectWithoutProperties(_ref, _excluded);
|