xctc-utils 1.6.59 → 1.6.61
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/dist/canvas/index.js +4 -4
- package/dist/event/index.js +2 -2
- package/dist/event/mouse-move.js +1 -1
- package/dist/handle/create.d.ts +4 -4
- package/dist/handle/create.js +14 -13
- package/package.json +1 -1
package/dist/canvas/index.js
CHANGED
|
@@ -331,13 +331,13 @@ var CanvasHooks = /** @class */ (function () {
|
|
|
331
331
|
// 创建SVG到画布
|
|
332
332
|
CanvasHooks.prototype.createCanvasSvgElementFn = function (item, index) {
|
|
333
333
|
var _ = this;
|
|
334
|
-
var boundFunction = create_1.CreateCanvasSvgElementFn.bind(_,
|
|
334
|
+
var boundFunction = create_1.CreateCanvasSvgElementFn.bind(_, item, index);
|
|
335
335
|
boundFunction();
|
|
336
336
|
};
|
|
337
337
|
// 创建图片到画布
|
|
338
338
|
CanvasHooks.prototype.createCanvasImageElementFn = function (item, index) {
|
|
339
339
|
var _ = this;
|
|
340
|
-
var boundFunction = create_1.CreateCanvasImageElementFn.bind(_,
|
|
340
|
+
var boundFunction = create_1.CreateCanvasImageElementFn.bind(_, item, index);
|
|
341
341
|
boundFunction();
|
|
342
342
|
};
|
|
343
343
|
// 获取到所有被框选的对象
|
|
@@ -355,13 +355,13 @@ var CanvasHooks = /** @class */ (function () {
|
|
|
355
355
|
// 创建自定义图像
|
|
356
356
|
CanvasHooks.prototype.createSelectionRectFn = function () {
|
|
357
357
|
var _ = this;
|
|
358
|
-
var boundFunction = create_1.CreateSelectionRectFn.bind(_
|
|
358
|
+
var boundFunction = create_1.CreateSelectionRectFn.bind(_);
|
|
359
359
|
boundFunction();
|
|
360
360
|
};
|
|
361
361
|
// 创建全选框
|
|
362
362
|
CanvasHooks.prototype.createAllSelectionRectFn = function () {
|
|
363
363
|
var _ = this;
|
|
364
|
-
var boundFunction = create_1.CreateAllSelectionRectFn.bind(_
|
|
364
|
+
var boundFunction = create_1.CreateAllSelectionRectFn.bind(_);
|
|
365
365
|
boundFunction();
|
|
366
366
|
};
|
|
367
367
|
// 删除全选对象选择框
|
package/dist/event/index.js
CHANGED
|
@@ -15,10 +15,10 @@ function checkMouseInElement(element) {
|
|
|
15
15
|
mouseY >= (rect === null || rect === void 0 ? void 0 : rect.top) &&
|
|
16
16
|
mouseY <= (rect === null || rect === void 0 ? void 0 : rect.bottom));
|
|
17
17
|
if (isInElement) {
|
|
18
|
-
console.log('鼠标在元素内部');
|
|
18
|
+
// console.log('鼠标在元素内部');
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
console.log('鼠标不在元素内部');
|
|
21
|
+
// console.log('鼠标不在元素内部');
|
|
22
22
|
}
|
|
23
23
|
win['mouseIsInElement'] = isInElement;
|
|
24
24
|
return isInElement;
|
package/dist/event/mouse-move.js
CHANGED
|
@@ -15,7 +15,7 @@ function RegisterMouseMoveEventFn(options) {
|
|
|
15
15
|
_.mouseCanvasInRangeStatus = win['mouseIsInElement'];
|
|
16
16
|
// 鼠标不在画布内,终止行为
|
|
17
17
|
if (!_.mouseCanvasInRangeStatus) {
|
|
18
|
-
console.log("鼠标不在画布内,终止行为");
|
|
18
|
+
// console.log("鼠标不在画布内,终止行为" );
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
var activeTarget = options.target || options.activeTarget;
|
package/dist/handle/create.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const xx: {};
|
|
2
2
|
export declare function CreateDragElementFn(): void;
|
|
3
3
|
export declare function InitElement2CanvasFn(list: any[]): void;
|
|
4
|
-
export declare function CreateCanvasSvgElementFn(
|
|
5
|
-
export declare function CreateCanvasImageElementFn(
|
|
6
|
-
export declare function CreateSelectionRectFn(
|
|
7
|
-
export declare function CreateAllSelectionRectFn(
|
|
4
|
+
export declare function CreateCanvasSvgElementFn(item: any, index?: number): void;
|
|
5
|
+
export declare function CreateCanvasImageElementFn(item: any, index?: number): void;
|
|
6
|
+
export declare function CreateSelectionRectFn(): void;
|
|
7
|
+
export declare function CreateAllSelectionRectFn(): void;
|
|
8
8
|
export declare function CreateRightClickMenuFn(options: any): void;
|
|
9
9
|
export declare function CreateElementFn(domVal: any, id: string, index?: number): void;
|
package/dist/handle/create.js
CHANGED
|
@@ -14,6 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.CreateElementFn = exports.CreateRightClickMenuFn = exports.CreateAllSelectionRectFn = exports.CreateSelectionRectFn = exports.CreateCanvasImageElementFn = exports.CreateCanvasSvgElementFn = exports.InitElement2CanvasFn = exports.CreateDragElementFn = exports.xx = void 0;
|
|
15
15
|
var utils_1 = require("../utils");
|
|
16
16
|
var is_1 = require("../is");
|
|
17
|
+
var fabric_1 = require("fabric");
|
|
17
18
|
exports.xx = {};
|
|
18
19
|
function CreateDragElementFn() {
|
|
19
20
|
var _a, _b, _c, _d, _e;
|
|
@@ -33,10 +34,10 @@ function CreateDragElementFn() {
|
|
|
33
34
|
var item = __assign(__assign({}, _.dragElementDataSource), { top: top, left: left });
|
|
34
35
|
// 拖拽数据类型为SVG图片对象
|
|
35
36
|
if (type == "svg") {
|
|
36
|
-
_.
|
|
37
|
+
_.CreateCanvasSvgElementFn(item);
|
|
37
38
|
}
|
|
38
39
|
else {
|
|
39
|
-
_.
|
|
40
|
+
_.CreateCanvasImageElementFn(item);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
exports.CreateDragElementFn = CreateDragElementFn;
|
|
@@ -55,17 +56,17 @@ function InitElement2CanvasFn(list) {
|
|
|
55
56
|
if (item.hasOwnProperty("left") && item.hasOwnProperty("top")) {
|
|
56
57
|
var type = (item === null || item === void 0 ? void 0 : item.renderType) || "image";
|
|
57
58
|
if (type == "svg") {
|
|
58
|
-
_.
|
|
59
|
+
_.CreateCanvasSvgElementFn(item, index);
|
|
59
60
|
}
|
|
60
61
|
else {
|
|
61
|
-
_.
|
|
62
|
+
_.CreateCanvasImageElementFn(item, index);
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
exports.InitElement2CanvasFn = InitElement2CanvasFn;
|
|
68
|
-
function CreateCanvasSvgElementFn(
|
|
69
|
+
function CreateCanvasSvgElementFn(item, index) {
|
|
69
70
|
if (!(0, is_1.isObject)(item)) {
|
|
70
71
|
return;
|
|
71
72
|
}
|
|
@@ -74,7 +75,7 @@ function CreateCanvasSvgElementFn(fabric, item, index) {
|
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
77
|
var createDragElementBackFn = (_.callBackEventConfig || {}).createDragElementBackFn;
|
|
77
|
-
fabric.loadSVGFromURL(item === null || item === void 0 ? void 0 : item.address, function (objects) {
|
|
78
|
+
fabric_1.fabric.loadSVGFromURL(item === null || item === void 0 ? void 0 : item.address, function (objects) {
|
|
78
79
|
var svgObject = (objects === null || objects === void 0 ? void 0 : objects.length) ? objects[0] : "";
|
|
79
80
|
if (!svgObject) {
|
|
80
81
|
return;
|
|
@@ -95,7 +96,7 @@ function CreateCanvasSvgElementFn(fabric, item, index) {
|
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
exports.CreateCanvasSvgElementFn = CreateCanvasSvgElementFn;
|
|
98
|
-
function CreateCanvasImageElementFn(
|
|
99
|
+
function CreateCanvasImageElementFn(item, index) {
|
|
99
100
|
var _a;
|
|
100
101
|
if (!(0, is_1.isObject)(item)) {
|
|
101
102
|
return;
|
|
@@ -105,7 +106,7 @@ function CreateCanvasImageElementFn(fabric, item, index) {
|
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
108
|
var createDragElementBackFn = (_.callBackEventConfig || {}).createDragElementBackFn;
|
|
108
|
-
fabric.Image.fromURL((_a = _.dragElementDataSource) === null || _a === void 0 ? void 0 : _a.address, function (img) {
|
|
109
|
+
fabric_1.fabric.Image.fromURL((_a = _.dragElementDataSource) === null || _a === void 0 ? void 0 : _a.address, function (img) {
|
|
109
110
|
img.set(__assign({}, item));
|
|
110
111
|
_.canvasDataSource.add(img);
|
|
111
112
|
_.canvasCreateElementsDataSource.push(img);
|
|
@@ -126,13 +127,13 @@ function CreateCanvasImageElementFn(fabric, item, index) {
|
|
|
126
127
|
});
|
|
127
128
|
}
|
|
128
129
|
exports.CreateCanvasImageElementFn = CreateCanvasImageElementFn;
|
|
129
|
-
function CreateSelectionRectFn(
|
|
130
|
+
function CreateSelectionRectFn() {
|
|
130
131
|
var _a, _b;
|
|
131
132
|
var _ = this;
|
|
132
133
|
if (!_.canvasDataSource) {
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
|
-
_.createSelectionRectDataSource = new fabric.Rect({
|
|
136
|
+
_.createSelectionRectDataSource = new fabric_1.fabric.Rect({
|
|
136
137
|
left: (_a = _.mousePointerDataSource) === null || _a === void 0 ? void 0 : _a.x,
|
|
137
138
|
top: (_b = _.mousePointerDataSource) === null || _b === void 0 ? void 0 : _b.y,
|
|
138
139
|
width: 0,
|
|
@@ -152,16 +153,16 @@ function CreateSelectionRectFn(fabric) {
|
|
|
152
153
|
_.canvasDataSource.requestRenderAll();
|
|
153
154
|
}
|
|
154
155
|
exports.CreateSelectionRectFn = CreateSelectionRectFn;
|
|
155
|
-
function CreateAllSelectionRectFn(
|
|
156
|
+
function CreateAllSelectionRectFn() {
|
|
156
157
|
var _ = this;
|
|
157
158
|
if (!_.canvasDataSource) {
|
|
158
159
|
return;
|
|
159
160
|
}
|
|
160
161
|
var container = (0, utils_1.getDomFn)("canvasContainer");
|
|
161
|
-
console.log("xxx---",
|
|
162
|
+
// console.log("xxx---",_.canvasDataSource.getWidth());
|
|
162
163
|
var containerWidth = container.offsetWidth;
|
|
163
164
|
var containerHeight = container.offsetWidth;
|
|
164
|
-
_.createSelectionRectDataSource = new fabric.Rect({
|
|
165
|
+
_.createSelectionRectDataSource = new fabric_1.fabric.Rect({
|
|
165
166
|
left: 0,
|
|
166
167
|
top: 0,
|
|
167
168
|
width: _.canvasDataSource.getWidth(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xctc-utils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.61",
|
|
4
4
|
"description": "localStorage存储\r ```\r sessionStorage存储\r ```\r crypto-js加密、解密\r ```\r 微信授权登录、微信分享\r ```\r 设备环境获取\r ```\r 是否是微信浏览器\r ```\r 时间戳转时间,字符串转时间戳",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|