redhotmagma-graphics-editor 1.51.0 → 1.51.2
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
|
@@ -4,39 +4,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CanvasObject = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _CanvasObject2 = require("../../../CanvasInterface/Objects/CanvasObject");
|
|
8
8
|
var _Calc2D = require("../../../Utils/Calc2D");
|
|
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
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
function
|
|
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 _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
18
|
+
function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
|
|
19
|
+
function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
|
|
20
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
21
|
+
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); }
|
|
22
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, 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); }
|
|
25
26
|
var CanvasObject = exports.CanvasObject = /*#__PURE__*/function (_AbstractCanvasObject) {
|
|
26
|
-
_inherits(CanvasObject, _AbstractCanvasObject);
|
|
27
|
-
var _super = _createSuper(CanvasObject);
|
|
28
27
|
function CanvasObject(options) {
|
|
29
28
|
var _this;
|
|
30
29
|
_classCallCheck(this, CanvasObject);
|
|
31
|
-
_this =
|
|
32
|
-
_defineProperty(
|
|
33
|
-
_this._observable.triggerEvent(
|
|
30
|
+
_this = _callSuper(this, CanvasObject, [options]);
|
|
31
|
+
_defineProperty(_this, "triggerChangeEvent", function (prevState) {
|
|
32
|
+
_this._observable.triggerEvent(_CanvasObject2.CanvasObjectEvents.OnChange, {
|
|
34
33
|
prevState: prevState
|
|
35
34
|
});
|
|
36
35
|
});
|
|
37
36
|
return _this;
|
|
38
37
|
}
|
|
39
|
-
|
|
38
|
+
_inherits(CanvasObject, _AbstractCanvasObject);
|
|
39
|
+
return _createClass(CanvasObject, [{
|
|
40
40
|
key: "getOptionsFromWrappedObject",
|
|
41
41
|
value: function getOptionsFromWrappedObject() {
|
|
42
42
|
var o = this.wrappedObject;
|
|
@@ -156,7 +156,7 @@ var CanvasObject = exports.CanvasObject = /*#__PURE__*/function (_AbstractCanvas
|
|
|
156
156
|
}, {
|
|
157
157
|
key: "remove",
|
|
158
158
|
value: function remove() {
|
|
159
|
-
|
|
159
|
+
_superPropGet(CanvasObject, "remove", this, 3)([]);
|
|
160
160
|
this.wrappedObject.remove();
|
|
161
161
|
}
|
|
162
162
|
}, {
|
|
@@ -191,5 +191,4 @@ var CanvasObject = exports.CanvasObject = /*#__PURE__*/function (_AbstractCanvas
|
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
193
|
}]);
|
|
194
|
-
|
|
195
|
-
}(_CanvasObject.AbstractCanvasObject);
|
|
194
|
+
}(_CanvasObject2.AbstractCanvasObject);
|
|
@@ -6,39 +6,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Group = void 0;
|
|
7
7
|
var _CanvasObject2 = require("./CanvasObject");
|
|
8
8
|
var _paper = _interopRequireDefault(require("paper"));
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
10
|
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); }
|
|
11
11
|
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; }
|
|
12
12
|
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; }
|
|
13
|
-
function _classCallCheck(
|
|
14
|
-
function _defineProperties(
|
|
15
|
-
function _createClass(
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
function
|
|
25
|
-
function
|
|
26
|
-
function
|
|
27
|
-
function
|
|
13
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
14
|
+
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); } }
|
|
15
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
16
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
17
|
+
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); }
|
|
18
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
19
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
|
+
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
21
|
+
function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
|
|
22
|
+
function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
|
|
23
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
24
|
+
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); }
|
|
25
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
26
|
+
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; }
|
|
27
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
28
|
+
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); }
|
|
28
29
|
var Group = exports.Group = /*#__PURE__*/function (_CanvasObject) {
|
|
29
|
-
_inherits(Group, _CanvasObject);
|
|
30
|
-
var _super = _createSuper(Group);
|
|
31
30
|
function Group() {
|
|
32
31
|
var _this;
|
|
33
32
|
_classCallCheck(this, Group);
|
|
34
33
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
35
34
|
args[_key] = arguments[_key];
|
|
36
35
|
}
|
|
37
|
-
_this =
|
|
38
|
-
_defineProperty(
|
|
36
|
+
_this = _callSuper(this, Group, [].concat(args));
|
|
37
|
+
_defineProperty(_this, "_src", '');
|
|
39
38
|
return _this;
|
|
40
39
|
}
|
|
41
|
-
|
|
40
|
+
_inherits(Group, _CanvasObject);
|
|
41
|
+
return _createClass(Group, [{
|
|
42
42
|
key: "src",
|
|
43
43
|
get: function get() {
|
|
44
44
|
return this._src;
|
|
@@ -64,16 +64,14 @@ var Group = exports.Group = /*#__PURE__*/function (_CanvasObject) {
|
|
|
64
64
|
}, {
|
|
65
65
|
key: "toObject",
|
|
66
66
|
value: function toObject() {
|
|
67
|
-
var _get2;
|
|
68
67
|
var src = this.src;
|
|
69
68
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
70
69
|
args[_key2] = arguments[_key2];
|
|
71
70
|
}
|
|
72
|
-
return _objectSpread(_objectSpread({}, (
|
|
71
|
+
return _objectSpread(_objectSpread({}, _superPropGet(Group, "toObject", this, 3)(args)), {}, {
|
|
73
72
|
src: src
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
75
|
}]);
|
|
77
|
-
return Group;
|
|
78
76
|
}(_CanvasObject2.CanvasObject);
|
|
79
77
|
_defineProperty(Group, "type", 'Group');
|
|
@@ -6,43 +6,44 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Image = void 0;
|
|
7
7
|
var _CanvasObject2 = require("./CanvasObject");
|
|
8
8
|
var _paper = _interopRequireDefault(require("paper"));
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
10
|
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); }
|
|
11
11
|
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; }
|
|
12
12
|
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; }
|
|
13
|
-
function
|
|
14
|
-
function
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
function
|
|
25
|
-
function
|
|
26
|
-
function
|
|
27
|
-
function _getPrototypeOf(
|
|
28
|
-
function
|
|
29
|
-
function
|
|
30
|
-
function
|
|
13
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
14
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
15
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
16
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
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 _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
25
|
+
function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
|
|
26
|
+
function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); 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); }
|
|
31
33
|
var Image = exports.Image = /*#__PURE__*/function (_CanvasObject) {
|
|
32
|
-
_inherits(Image, _CanvasObject);
|
|
33
|
-
var _super = _createSuper(Image);
|
|
34
34
|
function Image(options) {
|
|
35
35
|
var _this;
|
|
36
36
|
_classCallCheck(this, Image);
|
|
37
|
-
_this =
|
|
37
|
+
_this = _callSuper(this, Image, [options]);
|
|
38
38
|
// it has to be called again to set the local properties correctly
|
|
39
|
-
_defineProperty(
|
|
40
|
-
_defineProperty(
|
|
41
|
-
_defineProperty(
|
|
39
|
+
_defineProperty(_this, "_src", '');
|
|
40
|
+
_defineProperty(_this, "_imageData", null);
|
|
41
|
+
_defineProperty(_this, "_transformImageSrc", null);
|
|
42
42
|
_this.initOptions(options);
|
|
43
43
|
return _this;
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
_inherits(Image, _CanvasObject);
|
|
46
|
+
return _createClass(Image, [{
|
|
46
47
|
key: "src",
|
|
47
48
|
get: function get() {
|
|
48
49
|
return this._src;
|
|
@@ -68,29 +69,27 @@ var Image = exports.Image = /*#__PURE__*/function (_CanvasObject) {
|
|
|
68
69
|
}, {
|
|
69
70
|
key: "updateOptions",
|
|
70
71
|
value: function () {
|
|
71
|
-
var _updateOptions = _asyncToGenerator(
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
var _updateOptions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
73
|
+
var _t;
|
|
74
|
+
return _regenerator().w(function (_context) {
|
|
75
|
+
while (1) switch (_context.n) {
|
|
74
76
|
case 0:
|
|
75
|
-
_context.
|
|
76
|
-
return
|
|
77
|
-
case
|
|
77
|
+
_context.n = 1;
|
|
78
|
+
return _superPropGet(Image, "updateOptions", this, 3)([options]);
|
|
79
|
+
case 1:
|
|
78
80
|
if (!options) {
|
|
79
|
-
_context.
|
|
81
|
+
_context.n = 2;
|
|
80
82
|
break;
|
|
81
83
|
}
|
|
82
|
-
|
|
83
|
-
if (!
|
|
84
|
-
_context.
|
|
84
|
+
_t = this.src;
|
|
85
|
+
if (!_t) {
|
|
86
|
+
_context.n = 2;
|
|
85
87
|
break;
|
|
86
88
|
}
|
|
87
|
-
_context.
|
|
89
|
+
_context.n = 2;
|
|
88
90
|
return this.loadFromURL();
|
|
89
|
-
case
|
|
90
|
-
return _context.
|
|
91
|
-
case 8:
|
|
92
|
-
case "end":
|
|
93
|
-
return _context.stop();
|
|
91
|
+
case 2:
|
|
92
|
+
return _context.a(2, this);
|
|
94
93
|
}
|
|
95
94
|
}, _callee, this);
|
|
96
95
|
}));
|
|
@@ -105,26 +104,26 @@ var Image = exports.Image = /*#__PURE__*/function (_CanvasObject) {
|
|
|
105
104
|
var _loadFromURL = _asyncToGenerator(function () {
|
|
106
105
|
var _this2 = this;
|
|
107
106
|
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.src;
|
|
108
|
-
return /*#__PURE__*/
|
|
109
|
-
var source;
|
|
110
|
-
return
|
|
111
|
-
while (1) switch (_context2.
|
|
107
|
+
return /*#__PURE__*/_regenerator().m(function _callee2() {
|
|
108
|
+
var source, _t2;
|
|
109
|
+
return _regenerator().w(function (_context2) {
|
|
110
|
+
while (1) switch (_context2.n) {
|
|
112
111
|
case 0:
|
|
113
112
|
if (!_this2._transformImageSrc) {
|
|
114
|
-
_context2.
|
|
113
|
+
_context2.n = 2;
|
|
115
114
|
break;
|
|
116
115
|
}
|
|
117
|
-
_context2.
|
|
116
|
+
_context2.n = 1;
|
|
118
117
|
return _this2._transformImageSrc(url);
|
|
119
|
-
case
|
|
120
|
-
|
|
121
|
-
_context2.
|
|
118
|
+
case 1:
|
|
119
|
+
_t2 = _context2.v;
|
|
120
|
+
_context2.n = 3;
|
|
122
121
|
break;
|
|
123
|
-
case
|
|
124
|
-
|
|
125
|
-
case
|
|
126
|
-
source =
|
|
127
|
-
return _context2.
|
|
122
|
+
case 2:
|
|
123
|
+
_t2 = url;
|
|
124
|
+
case 3:
|
|
125
|
+
source = _t2;
|
|
126
|
+
return _context2.a(2, new Promise(function (resolve, reject) {
|
|
128
127
|
var raster = _this2.wrappedObject || (_this2.wrappedObject = new _paper["default"].Raster({
|
|
129
128
|
crossOrigin: 'anonymous'
|
|
130
129
|
}));
|
|
@@ -137,9 +136,6 @@ var Image = exports.Image = /*#__PURE__*/function (_CanvasObject) {
|
|
|
137
136
|
});
|
|
138
137
|
raster.setSource(source);
|
|
139
138
|
}));
|
|
140
|
-
case 9:
|
|
141
|
-
case "end":
|
|
142
|
-
return _context2.stop();
|
|
143
139
|
}
|
|
144
140
|
}, _callee2);
|
|
145
141
|
})();
|
|
@@ -152,18 +148,16 @@ var Image = exports.Image = /*#__PURE__*/function (_CanvasObject) {
|
|
|
152
148
|
}, {
|
|
153
149
|
key: "toObject",
|
|
154
150
|
value: function toObject() {
|
|
155
|
-
var _get2;
|
|
156
151
|
var src = this.src,
|
|
157
152
|
imageData = this.imageData;
|
|
158
153
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
159
154
|
args[_key] = arguments[_key];
|
|
160
155
|
}
|
|
161
|
-
return _objectSpread(_objectSpread({}, (
|
|
156
|
+
return _objectSpread(_objectSpread({}, _superPropGet(Image, "toObject", this, 3)(args)), {}, {
|
|
162
157
|
src: src,
|
|
163
158
|
imageData: imageData
|
|
164
159
|
});
|
|
165
160
|
}
|
|
166
161
|
}]);
|
|
167
|
-
return Image;
|
|
168
162
|
}(_CanvasObject2.CanvasObject);
|
|
169
163
|
_defineProperty(Image, "type", 'Image');
|