ecinc-cloud-moahygl 9.5.235 → 9.5.236
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/lib/ecmoahygl.common.js +76 -78
- package/lib/ecmoahygl.umd.js +76 -78
- package/lib/ecmoahygl.umd.min.js +2 -2
- package/package.json +1 -1
package/lib/ecmoahygl.common.js
CHANGED
|
@@ -43892,7 +43892,6 @@ var component = normalizeComponent(
|
|
|
43892
43892
|
|
|
43893
43893
|
/* harmony default export */ var CallServeDialog = (component.exports);
|
|
43894
43894
|
;// CONCATENATED MODULE: ./packages/ecmoa/hygl/src/ipad/drawboard/tools/pen.js
|
|
43895
|
-
var _this = undefined;
|
|
43896
43895
|
var Pen = {};
|
|
43897
43896
|
Pen.canvas = null;
|
|
43898
43897
|
Pen.context = null;
|
|
@@ -43909,36 +43908,36 @@ Pen.startPoint = null; // 线条绘制起点
|
|
|
43909
43908
|
* @param {Object} config 画笔配置
|
|
43910
43909
|
*/
|
|
43911
43910
|
Pen.constructor = function (target, config) {
|
|
43912
|
-
|
|
43913
|
-
|
|
43911
|
+
Pen.canvas = target;
|
|
43912
|
+
Pen.context = target.getContext('2d');
|
|
43914
43913
|
if (config) {
|
|
43915
|
-
|
|
43914
|
+
Pen._config = Object.assign(Pen._config, config);
|
|
43916
43915
|
}
|
|
43917
|
-
|
|
43918
|
-
|
|
43916
|
+
Pen.setListener(target);
|
|
43917
|
+
Pen.setPenConfig(Pen._config);
|
|
43919
43918
|
};
|
|
43920
43919
|
|
|
43921
43920
|
// methods
|
|
43922
43921
|
Pen.setPenConfig = function (_config) {
|
|
43923
|
-
var context =
|
|
43922
|
+
var context = Pen.context;
|
|
43924
43923
|
context.lineJoin = 'round';
|
|
43925
43924
|
context.lineCap = 'round';
|
|
43926
43925
|
};
|
|
43927
43926
|
Pen.setListener = function (target) {
|
|
43928
|
-
target.addEventListener('mousedown',
|
|
43929
|
-
target.addEventListener('mouseup',
|
|
43930
|
-
target.addEventListener('touchstart',
|
|
43931
|
-
target.addEventListener('touchend',
|
|
43927
|
+
target.addEventListener('mousedown', Pen.startDrawing, false);
|
|
43928
|
+
target.addEventListener('mouseup', Pen.stopDrawing, false);
|
|
43929
|
+
target.addEventListener('touchstart', Pen.startDrawing, false);
|
|
43930
|
+
target.addEventListener('touchend', Pen.stopDrawing, false);
|
|
43932
43931
|
};
|
|
43933
43932
|
Pen.removeListener = function (target) {
|
|
43934
|
-
target.removeEventListener('mousedown',
|
|
43935
|
-
target.removeEventListener('mouseup',
|
|
43936
|
-
target.removeEventListener('touchstart',
|
|
43937
|
-
target.removeEventListener('touchend',
|
|
43933
|
+
target.removeEventListener('mousedown', Pen.startDrawing, false);
|
|
43934
|
+
target.removeEventListener('mouseup', Pen.stopDrawing, false);
|
|
43935
|
+
target.removeEventListener('touchstart', Pen.startDrawing, false);
|
|
43936
|
+
target.removeEventListener('touchend', Pen.stopDrawing, false);
|
|
43938
43937
|
};
|
|
43939
43938
|
// 绘制二次贝塞尔曲线
|
|
43940
43939
|
Pen.drawLine = function (beginPoint, controlPoint, endPoint) {
|
|
43941
|
-
var context =
|
|
43940
|
+
var context = Pen.context;
|
|
43942
43941
|
context.beginPath();
|
|
43943
43942
|
context.moveTo(beginPoint.x, beginPoint.y);
|
|
43944
43943
|
context.quadraticCurveTo(controlPoint.x, controlPoint.y, endPoint.x, endPoint.y);
|
|
@@ -43947,29 +43946,29 @@ Pen.drawLine = function (beginPoint, controlPoint, endPoint) {
|
|
|
43947
43946
|
};
|
|
43948
43947
|
// 开始绘制
|
|
43949
43948
|
Pen.startDrawing = function (evt) {
|
|
43950
|
-
var canvas =
|
|
43951
|
-
_config =
|
|
43952
|
-
context =
|
|
43953
|
-
var
|
|
43954
|
-
x =
|
|
43955
|
-
y =
|
|
43949
|
+
var canvas = Pen.canvas,
|
|
43950
|
+
_config = Pen._config,
|
|
43951
|
+
context = Pen.context;
|
|
43952
|
+
var _Pen$getPoint = Pen.getPoint(evt),
|
|
43953
|
+
x = _Pen$getPoint.x,
|
|
43954
|
+
y = _Pen$getPoint.y;
|
|
43956
43955
|
context.strokeStyle = _config.color;
|
|
43957
43956
|
context.lineWidth = _config.weight;
|
|
43958
|
-
|
|
43957
|
+
Pen.startPoint = {
|
|
43959
43958
|
x: x,
|
|
43960
43959
|
y: y
|
|
43961
43960
|
};
|
|
43962
|
-
|
|
43963
|
-
canvas.addEventListener('mousemove',
|
|
43964
|
-
canvas.addEventListener('touchmove',
|
|
43961
|
+
Pen.points.push(Pen.startPoint);
|
|
43962
|
+
canvas.addEventListener('mousemove', Pen.onDrawing, false);
|
|
43963
|
+
canvas.addEventListener('touchmove', Pen.onDrawing, false);
|
|
43965
43964
|
};
|
|
43966
43965
|
// 拖动鼠标绘制
|
|
43967
43966
|
Pen.onDrawing = function (evt) {
|
|
43968
43967
|
evt.preventDefault();
|
|
43969
|
-
var points =
|
|
43970
|
-
var
|
|
43971
|
-
x =
|
|
43972
|
-
y =
|
|
43968
|
+
var points = Pen.points;
|
|
43969
|
+
var _Pen$getPoint2 = Pen.getPoint(evt),
|
|
43970
|
+
x = _Pen$getPoint2.x,
|
|
43971
|
+
y = _Pen$getPoint2.y;
|
|
43973
43972
|
points.push({
|
|
43974
43973
|
x: x,
|
|
43975
43974
|
y: y
|
|
@@ -43981,20 +43980,20 @@ Pen.onDrawing = function (evt) {
|
|
|
43981
43980
|
x: (lastTwoPoints[0].x + lastTwoPoints[1].x) / 2,
|
|
43982
43981
|
y: (lastTwoPoints[0].y + lastTwoPoints[1].y) / 2
|
|
43983
43982
|
};
|
|
43984
|
-
|
|
43985
|
-
|
|
43983
|
+
Pen.drawLine(Pen.startPoint, controlPoint, endPoint);
|
|
43984
|
+
Pen.startPoint = endPoint;
|
|
43986
43985
|
}
|
|
43987
43986
|
};
|
|
43988
43987
|
// 绘制结束
|
|
43989
43988
|
Pen.stopDrawing = function (evt) {
|
|
43990
|
-
var canvas =
|
|
43991
|
-
points =
|
|
43992
|
-
startPoint =
|
|
43993
|
-
canvas.removeEventListener('mousemove',
|
|
43994
|
-
canvas.removeEventListener('touchmove',
|
|
43995
|
-
var
|
|
43996
|
-
x =
|
|
43997
|
-
y =
|
|
43989
|
+
var canvas = Pen.canvas,
|
|
43990
|
+
points = Pen.points,
|
|
43991
|
+
startPoint = Pen.startPoint;
|
|
43992
|
+
canvas.removeEventListener('mousemove', Pen.onDrawing);
|
|
43993
|
+
canvas.removeEventListener('touchmove', Pen.onDrawing);
|
|
43994
|
+
var _Pen$getPoint3 = Pen.getPoint(evt),
|
|
43995
|
+
x = _Pen$getPoint3.x,
|
|
43996
|
+
y = _Pen$getPoint3.y;
|
|
43998
43997
|
points.push({
|
|
43999
43998
|
x: x,
|
|
44000
43999
|
y: y
|
|
@@ -44003,12 +44002,12 @@ Pen.stopDrawing = function (evt) {
|
|
|
44003
44002
|
var lastTwoPoints = points.slice(-2);
|
|
44004
44003
|
var controlPoint = lastTwoPoints[0];
|
|
44005
44004
|
var endPoint = lastTwoPoints[1];
|
|
44006
|
-
|
|
44005
|
+
Pen.drawLine(startPoint, controlPoint, endPoint);
|
|
44007
44006
|
}
|
|
44008
|
-
Pen.runningHistory &&
|
|
44007
|
+
Pen.runningHistory && Pen.runningHistory.add({
|
|
44009
44008
|
type: 'pen',
|
|
44010
44009
|
points: points,
|
|
44011
|
-
config:
|
|
44010
|
+
config: Pen._config
|
|
44012
44011
|
});
|
|
44013
44012
|
Pen.startPoint = null;
|
|
44014
44013
|
Pen.points = [];
|
|
@@ -44018,11 +44017,11 @@ Pen.getPoint = function (evt) {
|
|
|
44018
44017
|
var x = null;
|
|
44019
44018
|
var y = null;
|
|
44020
44019
|
if (evt.touches && evt.touches[0]) {
|
|
44021
|
-
var canvasOffset =
|
|
44020
|
+
var canvasOffset = Pen.canvas.getBoundingClientRect();
|
|
44022
44021
|
var touch = evt.touches[0];
|
|
44023
44022
|
var computedX = touch.pageX - canvasOffset.x;
|
|
44024
44023
|
var computedY = touch.pageY - canvasOffset.y;
|
|
44025
|
-
var scale =
|
|
44024
|
+
var scale = Pen.canvas.height / Pen.canvas.clientHeight;
|
|
44026
44025
|
x = computedX * scale;
|
|
44027
44026
|
y = computedY * scale;
|
|
44028
44027
|
} else {
|
|
@@ -44047,19 +44046,18 @@ history_History.cacheStack = [];
|
|
|
44047
44046
|
history_History.step = null;
|
|
44048
44047
|
history_History.constructor = function (cache) {
|
|
44049
44048
|
if (!cache) return;
|
|
44050
|
-
|
|
44051
|
-
|
|
44049
|
+
history_History.cacheStack = _toConsumableArray(cache.cacheStack);
|
|
44050
|
+
history_History.step = cache.step;
|
|
44052
44051
|
};
|
|
44053
44052
|
history_History.add = function (drawData) {
|
|
44054
44053
|
if (drawData.type && drawData.points instanceof Array) {
|
|
44055
|
-
|
|
44056
|
-
|
|
44054
|
+
history_History.cacheStack.push(drawData);
|
|
44055
|
+
history_History.step++;
|
|
44057
44056
|
}
|
|
44058
44057
|
};
|
|
44059
44058
|
|
|
44060
44059
|
;// CONCATENATED MODULE: ./packages/ecmoa/hygl/src/ipad/drawboard/index.js
|
|
44061
44060
|
function drawboard_typeof(o) { "@babel/helpers - typeof"; return drawboard_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; }, drawboard_typeof(o); }
|
|
44062
|
-
var drawboard_this = undefined;
|
|
44063
44061
|
function drawboard_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ drawboard_regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == drawboard_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(drawboard_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
44064
44062
|
function drawboard_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); }
|
|
44065
44063
|
function drawboard_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { drawboard_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { drawboard_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
@@ -44087,54 +44085,54 @@ DrawBoard.runningHistory = null;
|
|
|
44087
44085
|
* @param {Element} canvasElement 画布元素
|
|
44088
44086
|
*/
|
|
44089
44087
|
DrawBoard.constructor = function (canvasElement) {
|
|
44090
|
-
|
|
44091
|
-
|
|
44092
|
-
|
|
44088
|
+
DrawBoard.canvas = canvasElement;
|
|
44089
|
+
DrawBoard.context = canvasElement.getContext('2d');
|
|
44090
|
+
DrawBoard._config = Object.assign(DrawBoard._config, {
|
|
44093
44091
|
width: canvasElement.width,
|
|
44094
44092
|
height: canvasElement.height
|
|
44095
44093
|
});
|
|
44096
44094
|
};
|
|
44097
44095
|
DrawBoard.install = function () {
|
|
44098
|
-
var canvas =
|
|
44096
|
+
var canvas = DrawBoard.canvas;
|
|
44099
44097
|
var canvasHistory = canvas.CACHE_STACK ? canvas.CACHE_STACK : null;
|
|
44100
|
-
|
|
44101
|
-
return
|
|
44098
|
+
DrawBoard.runningHistory = new history_History(canvasHistory);
|
|
44099
|
+
return DrawBoard;
|
|
44102
44100
|
};
|
|
44103
44101
|
DrawBoard.uninstall = function () {
|
|
44104
|
-
|
|
44105
|
-
|
|
44102
|
+
DrawBoard.canvas.CACHE_STACK = DrawBoard.runningHistory;
|
|
44103
|
+
DrawBoard.removeEvents();
|
|
44106
44104
|
};
|
|
44107
44105
|
|
|
44108
44106
|
// canvas methods
|
|
44109
44107
|
// 清除canvas内容
|
|
44110
44108
|
DrawBoard.clear = function () {
|
|
44111
|
-
var
|
|
44112
|
-
width =
|
|
44113
|
-
height =
|
|
44114
|
-
|
|
44109
|
+
var _DrawBoard$_config = DrawBoard._config,
|
|
44110
|
+
width = _DrawBoard$_config.width,
|
|
44111
|
+
height = _DrawBoard$_config.height;
|
|
44112
|
+
DrawBoard.context.clearRect(0, 0, width, height);
|
|
44115
44113
|
};
|
|
44116
44114
|
// 清除事件监听
|
|
44117
44115
|
DrawBoard.removeEvents = function () {
|
|
44118
|
-
var _TOOL =
|
|
44119
|
-
canvas =
|
|
44116
|
+
var _TOOL = DrawBoard._TOOL,
|
|
44117
|
+
canvas = DrawBoard.canvas;
|
|
44120
44118
|
_TOOL.removeListener(canvas);
|
|
44121
44119
|
};
|
|
44122
44120
|
DrawBoard.setColor = function (color) {
|
|
44123
|
-
|
|
44121
|
+
DrawBoard._TOOL._config.color = color;
|
|
44124
44122
|
};
|
|
44125
44123
|
DrawBoard.setWeight = function (weight) {
|
|
44126
|
-
|
|
44124
|
+
DrawBoard._TOOL._config.weight = weight;
|
|
44127
44125
|
};
|
|
44128
44126
|
// 工具使用
|
|
44129
44127
|
DrawBoard.use = function (tool, config) {
|
|
44130
|
-
var canvas =
|
|
44128
|
+
var canvas = DrawBoard.canvas;
|
|
44131
44129
|
switch (tool) {
|
|
44132
44130
|
case 'pen':
|
|
44133
|
-
|
|
44134
|
-
|
|
44135
|
-
|
|
44136
|
-
console.log('
|
|
44137
|
-
|
|
44131
|
+
DrawBoard._TOOL && DrawBoard._TOOL.removeListener(canvas);
|
|
44132
|
+
DrawBoard._MODE = tool;
|
|
44133
|
+
DrawBoard._TOOL = new Pen(canvas, config || null);
|
|
44134
|
+
console.log('DrawBoard._TOOL => ', DrawBoard._TOOL);
|
|
44135
|
+
DrawBoard._TOOL.runningHistory = DrawBoard.runningHistory;
|
|
44138
44136
|
break;
|
|
44139
44137
|
default:
|
|
44140
44138
|
break;
|
|
@@ -44182,15 +44180,15 @@ DrawBoard.getEachImage = function () {
|
|
|
44182
44180
|
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'blob';
|
|
44183
44181
|
var quality = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1.0';
|
|
44184
44182
|
var results = [];
|
|
44185
|
-
|
|
44183
|
+
DrawBoard.runningHistory.cacheStack.forEach( /*#__PURE__*/function () {
|
|
44186
44184
|
var _ref = drawboard_asyncToGenerator( /*#__PURE__*/drawboard_regeneratorRuntime().mark(function _callee(cache) {
|
|
44187
44185
|
var imageInfo, imageData;
|
|
44188
44186
|
return drawboard_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
44189
44187
|
while (1) switch (_context.prev = _context.next) {
|
|
44190
44188
|
case 0:
|
|
44191
|
-
imageInfo =
|
|
44189
|
+
imageInfo = DrawBoard.getImageInfo(cache.points);
|
|
44192
44190
|
_context.next = 3;
|
|
44193
|
-
return
|
|
44191
|
+
return DrawBoard.getImageFromCanvas(imageInfo, type, quality);
|
|
44194
44192
|
case 3:
|
|
44195
44193
|
imageData = _context.sent;
|
|
44196
44194
|
results.push(imageData);
|
|
@@ -44212,8 +44210,8 @@ DrawBoard.getEachImage = function () {
|
|
|
44212
44210
|
*/
|
|
44213
44211
|
DrawBoard.getEachImageInfo = function () {
|
|
44214
44212
|
var results = [];
|
|
44215
|
-
|
|
44216
|
-
var imageInfo =
|
|
44213
|
+
DrawBoard.runningHistory.cacheStack.forEach(function (cache) {
|
|
44214
|
+
var imageInfo = DrawBoard.getImageInfo(cache.points);
|
|
44217
44215
|
results.push(imageInfo);
|
|
44218
44216
|
});
|
|
44219
44217
|
return results;
|
|
@@ -44236,7 +44234,7 @@ DrawBoard.getImageFromCanvas = function (imageInfo, type, quality) {
|
|
|
44236
44234
|
Temp.width = width;
|
|
44237
44235
|
Temp.setAttribute('style', "height:".concat(height, "px;width:").concat(width, "px;"));
|
|
44238
44236
|
var TempContent = Temp.getContext('2d');
|
|
44239
|
-
TempContent.drawImage(
|
|
44237
|
+
TempContent.drawImage(DrawBoard.canvas, x, y, width, height, 0, 0, width, height);
|
|
44240
44238
|
return new Promise(function (resolve) {
|
|
44241
44239
|
if (type === 'blob') {
|
|
44242
44240
|
Temp.toBlob(function (blob) {
|
package/lib/ecmoahygl.umd.js
CHANGED
|
@@ -43910,7 +43910,6 @@ var component = normalizeComponent(
|
|
|
43910
43910
|
|
|
43911
43911
|
/* harmony default export */ var CallServeDialog = (component.exports);
|
|
43912
43912
|
;// CONCATENATED MODULE: ./packages/ecmoa/hygl/src/ipad/drawboard/tools/pen.js
|
|
43913
|
-
var _this = undefined;
|
|
43914
43913
|
var Pen = {};
|
|
43915
43914
|
Pen.canvas = null;
|
|
43916
43915
|
Pen.context = null;
|
|
@@ -43927,36 +43926,36 @@ Pen.startPoint = null; // 线条绘制起点
|
|
|
43927
43926
|
* @param {Object} config 画笔配置
|
|
43928
43927
|
*/
|
|
43929
43928
|
Pen.constructor = function (target, config) {
|
|
43930
|
-
|
|
43931
|
-
|
|
43929
|
+
Pen.canvas = target;
|
|
43930
|
+
Pen.context = target.getContext('2d');
|
|
43932
43931
|
if (config) {
|
|
43933
|
-
|
|
43932
|
+
Pen._config = Object.assign(Pen._config, config);
|
|
43934
43933
|
}
|
|
43935
|
-
|
|
43936
|
-
|
|
43934
|
+
Pen.setListener(target);
|
|
43935
|
+
Pen.setPenConfig(Pen._config);
|
|
43937
43936
|
};
|
|
43938
43937
|
|
|
43939
43938
|
// methods
|
|
43940
43939
|
Pen.setPenConfig = function (_config) {
|
|
43941
|
-
var context =
|
|
43940
|
+
var context = Pen.context;
|
|
43942
43941
|
context.lineJoin = 'round';
|
|
43943
43942
|
context.lineCap = 'round';
|
|
43944
43943
|
};
|
|
43945
43944
|
Pen.setListener = function (target) {
|
|
43946
|
-
target.addEventListener('mousedown',
|
|
43947
|
-
target.addEventListener('mouseup',
|
|
43948
|
-
target.addEventListener('touchstart',
|
|
43949
|
-
target.addEventListener('touchend',
|
|
43945
|
+
target.addEventListener('mousedown', Pen.startDrawing, false);
|
|
43946
|
+
target.addEventListener('mouseup', Pen.stopDrawing, false);
|
|
43947
|
+
target.addEventListener('touchstart', Pen.startDrawing, false);
|
|
43948
|
+
target.addEventListener('touchend', Pen.stopDrawing, false);
|
|
43950
43949
|
};
|
|
43951
43950
|
Pen.removeListener = function (target) {
|
|
43952
|
-
target.removeEventListener('mousedown',
|
|
43953
|
-
target.removeEventListener('mouseup',
|
|
43954
|
-
target.removeEventListener('touchstart',
|
|
43955
|
-
target.removeEventListener('touchend',
|
|
43951
|
+
target.removeEventListener('mousedown', Pen.startDrawing, false);
|
|
43952
|
+
target.removeEventListener('mouseup', Pen.stopDrawing, false);
|
|
43953
|
+
target.removeEventListener('touchstart', Pen.startDrawing, false);
|
|
43954
|
+
target.removeEventListener('touchend', Pen.stopDrawing, false);
|
|
43956
43955
|
};
|
|
43957
43956
|
// 绘制二次贝塞尔曲线
|
|
43958
43957
|
Pen.drawLine = function (beginPoint, controlPoint, endPoint) {
|
|
43959
|
-
var context =
|
|
43958
|
+
var context = Pen.context;
|
|
43960
43959
|
context.beginPath();
|
|
43961
43960
|
context.moveTo(beginPoint.x, beginPoint.y);
|
|
43962
43961
|
context.quadraticCurveTo(controlPoint.x, controlPoint.y, endPoint.x, endPoint.y);
|
|
@@ -43965,29 +43964,29 @@ Pen.drawLine = function (beginPoint, controlPoint, endPoint) {
|
|
|
43965
43964
|
};
|
|
43966
43965
|
// 开始绘制
|
|
43967
43966
|
Pen.startDrawing = function (evt) {
|
|
43968
|
-
var canvas =
|
|
43969
|
-
_config =
|
|
43970
|
-
context =
|
|
43971
|
-
var
|
|
43972
|
-
x =
|
|
43973
|
-
y =
|
|
43967
|
+
var canvas = Pen.canvas,
|
|
43968
|
+
_config = Pen._config,
|
|
43969
|
+
context = Pen.context;
|
|
43970
|
+
var _Pen$getPoint = Pen.getPoint(evt),
|
|
43971
|
+
x = _Pen$getPoint.x,
|
|
43972
|
+
y = _Pen$getPoint.y;
|
|
43974
43973
|
context.strokeStyle = _config.color;
|
|
43975
43974
|
context.lineWidth = _config.weight;
|
|
43976
|
-
|
|
43975
|
+
Pen.startPoint = {
|
|
43977
43976
|
x: x,
|
|
43978
43977
|
y: y
|
|
43979
43978
|
};
|
|
43980
|
-
|
|
43981
|
-
canvas.addEventListener('mousemove',
|
|
43982
|
-
canvas.addEventListener('touchmove',
|
|
43979
|
+
Pen.points.push(Pen.startPoint);
|
|
43980
|
+
canvas.addEventListener('mousemove', Pen.onDrawing, false);
|
|
43981
|
+
canvas.addEventListener('touchmove', Pen.onDrawing, false);
|
|
43983
43982
|
};
|
|
43984
43983
|
// 拖动鼠标绘制
|
|
43985
43984
|
Pen.onDrawing = function (evt) {
|
|
43986
43985
|
evt.preventDefault();
|
|
43987
|
-
var points =
|
|
43988
|
-
var
|
|
43989
|
-
x =
|
|
43990
|
-
y =
|
|
43986
|
+
var points = Pen.points;
|
|
43987
|
+
var _Pen$getPoint2 = Pen.getPoint(evt),
|
|
43988
|
+
x = _Pen$getPoint2.x,
|
|
43989
|
+
y = _Pen$getPoint2.y;
|
|
43991
43990
|
points.push({
|
|
43992
43991
|
x: x,
|
|
43993
43992
|
y: y
|
|
@@ -43999,20 +43998,20 @@ Pen.onDrawing = function (evt) {
|
|
|
43999
43998
|
x: (lastTwoPoints[0].x + lastTwoPoints[1].x) / 2,
|
|
44000
43999
|
y: (lastTwoPoints[0].y + lastTwoPoints[1].y) / 2
|
|
44001
44000
|
};
|
|
44002
|
-
|
|
44003
|
-
|
|
44001
|
+
Pen.drawLine(Pen.startPoint, controlPoint, endPoint);
|
|
44002
|
+
Pen.startPoint = endPoint;
|
|
44004
44003
|
}
|
|
44005
44004
|
};
|
|
44006
44005
|
// 绘制结束
|
|
44007
44006
|
Pen.stopDrawing = function (evt) {
|
|
44008
|
-
var canvas =
|
|
44009
|
-
points =
|
|
44010
|
-
startPoint =
|
|
44011
|
-
canvas.removeEventListener('mousemove',
|
|
44012
|
-
canvas.removeEventListener('touchmove',
|
|
44013
|
-
var
|
|
44014
|
-
x =
|
|
44015
|
-
y =
|
|
44007
|
+
var canvas = Pen.canvas,
|
|
44008
|
+
points = Pen.points,
|
|
44009
|
+
startPoint = Pen.startPoint;
|
|
44010
|
+
canvas.removeEventListener('mousemove', Pen.onDrawing);
|
|
44011
|
+
canvas.removeEventListener('touchmove', Pen.onDrawing);
|
|
44012
|
+
var _Pen$getPoint3 = Pen.getPoint(evt),
|
|
44013
|
+
x = _Pen$getPoint3.x,
|
|
44014
|
+
y = _Pen$getPoint3.y;
|
|
44016
44015
|
points.push({
|
|
44017
44016
|
x: x,
|
|
44018
44017
|
y: y
|
|
@@ -44021,12 +44020,12 @@ Pen.stopDrawing = function (evt) {
|
|
|
44021
44020
|
var lastTwoPoints = points.slice(-2);
|
|
44022
44021
|
var controlPoint = lastTwoPoints[0];
|
|
44023
44022
|
var endPoint = lastTwoPoints[1];
|
|
44024
|
-
|
|
44023
|
+
Pen.drawLine(startPoint, controlPoint, endPoint);
|
|
44025
44024
|
}
|
|
44026
|
-
Pen.runningHistory &&
|
|
44025
|
+
Pen.runningHistory && Pen.runningHistory.add({
|
|
44027
44026
|
type: 'pen',
|
|
44028
44027
|
points: points,
|
|
44029
|
-
config:
|
|
44028
|
+
config: Pen._config
|
|
44030
44029
|
});
|
|
44031
44030
|
Pen.startPoint = null;
|
|
44032
44031
|
Pen.points = [];
|
|
@@ -44036,11 +44035,11 @@ Pen.getPoint = function (evt) {
|
|
|
44036
44035
|
var x = null;
|
|
44037
44036
|
var y = null;
|
|
44038
44037
|
if (evt.touches && evt.touches[0]) {
|
|
44039
|
-
var canvasOffset =
|
|
44038
|
+
var canvasOffset = Pen.canvas.getBoundingClientRect();
|
|
44040
44039
|
var touch = evt.touches[0];
|
|
44041
44040
|
var computedX = touch.pageX - canvasOffset.x;
|
|
44042
44041
|
var computedY = touch.pageY - canvasOffset.y;
|
|
44043
|
-
var scale =
|
|
44042
|
+
var scale = Pen.canvas.height / Pen.canvas.clientHeight;
|
|
44044
44043
|
x = computedX * scale;
|
|
44045
44044
|
y = computedY * scale;
|
|
44046
44045
|
} else {
|
|
@@ -44065,19 +44064,18 @@ history_History.cacheStack = [];
|
|
|
44065
44064
|
history_History.step = null;
|
|
44066
44065
|
history_History.constructor = function (cache) {
|
|
44067
44066
|
if (!cache) return;
|
|
44068
|
-
|
|
44069
|
-
|
|
44067
|
+
history_History.cacheStack = _toConsumableArray(cache.cacheStack);
|
|
44068
|
+
history_History.step = cache.step;
|
|
44070
44069
|
};
|
|
44071
44070
|
history_History.add = function (drawData) {
|
|
44072
44071
|
if (drawData.type && drawData.points instanceof Array) {
|
|
44073
|
-
|
|
44074
|
-
|
|
44072
|
+
history_History.cacheStack.push(drawData);
|
|
44073
|
+
history_History.step++;
|
|
44075
44074
|
}
|
|
44076
44075
|
};
|
|
44077
44076
|
|
|
44078
44077
|
;// CONCATENATED MODULE: ./packages/ecmoa/hygl/src/ipad/drawboard/index.js
|
|
44079
44078
|
function drawboard_typeof(o) { "@babel/helpers - typeof"; return drawboard_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; }, drawboard_typeof(o); }
|
|
44080
|
-
var drawboard_this = undefined;
|
|
44081
44079
|
function drawboard_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ drawboard_regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == drawboard_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(drawboard_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
44082
44080
|
function drawboard_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); }
|
|
44083
44081
|
function drawboard_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { drawboard_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { drawboard_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
@@ -44105,54 +44103,54 @@ DrawBoard.runningHistory = null;
|
|
|
44105
44103
|
* @param {Element} canvasElement 画布元素
|
|
44106
44104
|
*/
|
|
44107
44105
|
DrawBoard.constructor = function (canvasElement) {
|
|
44108
|
-
|
|
44109
|
-
|
|
44110
|
-
|
|
44106
|
+
DrawBoard.canvas = canvasElement;
|
|
44107
|
+
DrawBoard.context = canvasElement.getContext('2d');
|
|
44108
|
+
DrawBoard._config = Object.assign(DrawBoard._config, {
|
|
44111
44109
|
width: canvasElement.width,
|
|
44112
44110
|
height: canvasElement.height
|
|
44113
44111
|
});
|
|
44114
44112
|
};
|
|
44115
44113
|
DrawBoard.install = function () {
|
|
44116
|
-
var canvas =
|
|
44114
|
+
var canvas = DrawBoard.canvas;
|
|
44117
44115
|
var canvasHistory = canvas.CACHE_STACK ? canvas.CACHE_STACK : null;
|
|
44118
|
-
|
|
44119
|
-
return
|
|
44116
|
+
DrawBoard.runningHistory = new history_History(canvasHistory);
|
|
44117
|
+
return DrawBoard;
|
|
44120
44118
|
};
|
|
44121
44119
|
DrawBoard.uninstall = function () {
|
|
44122
|
-
|
|
44123
|
-
|
|
44120
|
+
DrawBoard.canvas.CACHE_STACK = DrawBoard.runningHistory;
|
|
44121
|
+
DrawBoard.removeEvents();
|
|
44124
44122
|
};
|
|
44125
44123
|
|
|
44126
44124
|
// canvas methods
|
|
44127
44125
|
// 清除canvas内容
|
|
44128
44126
|
DrawBoard.clear = function () {
|
|
44129
|
-
var
|
|
44130
|
-
width =
|
|
44131
|
-
height =
|
|
44132
|
-
|
|
44127
|
+
var _DrawBoard$_config = DrawBoard._config,
|
|
44128
|
+
width = _DrawBoard$_config.width,
|
|
44129
|
+
height = _DrawBoard$_config.height;
|
|
44130
|
+
DrawBoard.context.clearRect(0, 0, width, height);
|
|
44133
44131
|
};
|
|
44134
44132
|
// 清除事件监听
|
|
44135
44133
|
DrawBoard.removeEvents = function () {
|
|
44136
|
-
var _TOOL =
|
|
44137
|
-
canvas =
|
|
44134
|
+
var _TOOL = DrawBoard._TOOL,
|
|
44135
|
+
canvas = DrawBoard.canvas;
|
|
44138
44136
|
_TOOL.removeListener(canvas);
|
|
44139
44137
|
};
|
|
44140
44138
|
DrawBoard.setColor = function (color) {
|
|
44141
|
-
|
|
44139
|
+
DrawBoard._TOOL._config.color = color;
|
|
44142
44140
|
};
|
|
44143
44141
|
DrawBoard.setWeight = function (weight) {
|
|
44144
|
-
|
|
44142
|
+
DrawBoard._TOOL._config.weight = weight;
|
|
44145
44143
|
};
|
|
44146
44144
|
// 工具使用
|
|
44147
44145
|
DrawBoard.use = function (tool, config) {
|
|
44148
|
-
var canvas =
|
|
44146
|
+
var canvas = DrawBoard.canvas;
|
|
44149
44147
|
switch (tool) {
|
|
44150
44148
|
case 'pen':
|
|
44151
|
-
|
|
44152
|
-
|
|
44153
|
-
|
|
44154
|
-
console.log('
|
|
44155
|
-
|
|
44149
|
+
DrawBoard._TOOL && DrawBoard._TOOL.removeListener(canvas);
|
|
44150
|
+
DrawBoard._MODE = tool;
|
|
44151
|
+
DrawBoard._TOOL = new Pen(canvas, config || null);
|
|
44152
|
+
console.log('DrawBoard._TOOL => ', DrawBoard._TOOL);
|
|
44153
|
+
DrawBoard._TOOL.runningHistory = DrawBoard.runningHistory;
|
|
44156
44154
|
break;
|
|
44157
44155
|
default:
|
|
44158
44156
|
break;
|
|
@@ -44200,15 +44198,15 @@ DrawBoard.getEachImage = function () {
|
|
|
44200
44198
|
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'blob';
|
|
44201
44199
|
var quality = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1.0';
|
|
44202
44200
|
var results = [];
|
|
44203
|
-
|
|
44201
|
+
DrawBoard.runningHistory.cacheStack.forEach( /*#__PURE__*/function () {
|
|
44204
44202
|
var _ref = drawboard_asyncToGenerator( /*#__PURE__*/drawboard_regeneratorRuntime().mark(function _callee(cache) {
|
|
44205
44203
|
var imageInfo, imageData;
|
|
44206
44204
|
return drawboard_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
44207
44205
|
while (1) switch (_context.prev = _context.next) {
|
|
44208
44206
|
case 0:
|
|
44209
|
-
imageInfo =
|
|
44207
|
+
imageInfo = DrawBoard.getImageInfo(cache.points);
|
|
44210
44208
|
_context.next = 3;
|
|
44211
|
-
return
|
|
44209
|
+
return DrawBoard.getImageFromCanvas(imageInfo, type, quality);
|
|
44212
44210
|
case 3:
|
|
44213
44211
|
imageData = _context.sent;
|
|
44214
44212
|
results.push(imageData);
|
|
@@ -44230,8 +44228,8 @@ DrawBoard.getEachImage = function () {
|
|
|
44230
44228
|
*/
|
|
44231
44229
|
DrawBoard.getEachImageInfo = function () {
|
|
44232
44230
|
var results = [];
|
|
44233
|
-
|
|
44234
|
-
var imageInfo =
|
|
44231
|
+
DrawBoard.runningHistory.cacheStack.forEach(function (cache) {
|
|
44232
|
+
var imageInfo = DrawBoard.getImageInfo(cache.points);
|
|
44235
44233
|
results.push(imageInfo);
|
|
44236
44234
|
});
|
|
44237
44235
|
return results;
|
|
@@ -44254,7 +44252,7 @@ DrawBoard.getImageFromCanvas = function (imageInfo, type, quality) {
|
|
|
44254
44252
|
Temp.width = width;
|
|
44255
44253
|
Temp.setAttribute('style', "height:".concat(height, "px;width:").concat(width, "px;"));
|
|
44256
44254
|
var TempContent = Temp.getContext('2d');
|
|
44257
|
-
TempContent.drawImage(
|
|
44255
|
+
TempContent.drawImage(DrawBoard.canvas, x, y, width, height, 0, 0, width, height);
|
|
44258
44256
|
return new Promise(function (resolve) {
|
|
44259
44257
|
if (type === 'blob') {
|
|
44260
44258
|
Temp.toBlob(function (blob) {
|