xctc-utils 1.6.58 → 1.6.60

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.
@@ -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(_, fabric_1.fabric, item, index);
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(_, fabric_1.fabric, item, index);
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(_, fabric_1.fabric);
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(_, fabric_1.fabric);
364
+ var boundFunction = create_1.CreateAllSelectionRectFn.bind(_);
365
365
  boundFunction();
366
366
  };
367
367
  // 删除全选对象选择框
@@ -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;
@@ -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;
@@ -1,9 +1,9 @@
1
1
  export declare const xx: {};
2
- export declare function CreateDragElementFn(data: any): void;
2
+ export declare function CreateDragElementFn(): void;
3
3
  export declare function InitElement2CanvasFn(list: any[]): void;
4
- export declare function CreateCanvasSvgElementFn(fabric: any, item: any, index?: number): void;
5
- export declare function CreateCanvasImageElementFn(fabric: any, item: any, index?: number): void;
6
- export declare function CreateSelectionRectFn(fabric: any): void;
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
7
  export declare function CreateAllSelectionRectFn(fabric: any): void;
8
8
  export declare function CreateRightClickMenuFn(options: any): void;
9
9
  export declare function CreateElementFn(domVal: any, id: string, index?: number): void;
@@ -14,12 +14,10 @@ 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
- function CreateDragElementFn(data) {
19
+ function CreateDragElementFn() {
19
20
  var _a, _b, _c, _d, _e;
20
- if (!(0, is_1.isObject)(data)) {
21
- return;
22
- }
23
21
  var _ = this;
24
22
  if (!_.canvasDataSource) {
25
23
  return;
@@ -36,10 +34,10 @@ function CreateDragElementFn(data) {
36
34
  var item = __assign(__assign({}, _.dragElementDataSource), { top: top, left: left });
37
35
  // 拖拽数据类型为SVG图片对象
38
36
  if (type == "svg") {
39
- _.createCanvasSvgElementFn(item);
37
+ _.CreateCanvasSvgElementFn(item);
40
38
  }
41
39
  else {
42
- _.createCanvasImageElementFn(item);
40
+ _.CreateCanvasImageElementFn(item);
43
41
  }
44
42
  }
45
43
  exports.CreateDragElementFn = CreateDragElementFn;
@@ -58,17 +56,17 @@ function InitElement2CanvasFn(list) {
58
56
  if (item.hasOwnProperty("left") && item.hasOwnProperty("top")) {
59
57
  var type = (item === null || item === void 0 ? void 0 : item.renderType) || "image";
60
58
  if (type == "svg") {
61
- _.createCanvasSvgElementFn(item, index);
59
+ _.CreateCanvasSvgElementFn(item, index);
62
60
  }
63
61
  else {
64
- _.createCanvasImageElementFn(item, index);
62
+ _.CreateCanvasImageElementFn(item, index);
65
63
  }
66
64
  }
67
65
  });
68
66
  }
69
67
  }
70
68
  exports.InitElement2CanvasFn = InitElement2CanvasFn;
71
- function CreateCanvasSvgElementFn(fabric, item, index) {
69
+ function CreateCanvasSvgElementFn(item, index) {
72
70
  if (!(0, is_1.isObject)(item)) {
73
71
  return;
74
72
  }
@@ -77,7 +75,7 @@ function CreateCanvasSvgElementFn(fabric, item, index) {
77
75
  return;
78
76
  }
79
77
  var createDragElementBackFn = (_.callBackEventConfig || {}).createDragElementBackFn;
80
- 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) {
81
79
  var svgObject = (objects === null || objects === void 0 ? void 0 : objects.length) ? objects[0] : "";
82
80
  if (!svgObject) {
83
81
  return;
@@ -98,7 +96,7 @@ function CreateCanvasSvgElementFn(fabric, item, index) {
98
96
  });
99
97
  }
100
98
  exports.CreateCanvasSvgElementFn = CreateCanvasSvgElementFn;
101
- function CreateCanvasImageElementFn(fabric, item, index) {
99
+ function CreateCanvasImageElementFn(item, index) {
102
100
  var _a;
103
101
  if (!(0, is_1.isObject)(item)) {
104
102
  return;
@@ -108,7 +106,7 @@ function CreateCanvasImageElementFn(fabric, item, index) {
108
106
  return;
109
107
  }
110
108
  var createDragElementBackFn = (_.callBackEventConfig || {}).createDragElementBackFn;
111
- 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) {
112
110
  img.set(__assign({}, item));
113
111
  _.canvasDataSource.add(img);
114
112
  _.canvasCreateElementsDataSource.push(img);
@@ -129,13 +127,13 @@ function CreateCanvasImageElementFn(fabric, item, index) {
129
127
  });
130
128
  }
131
129
  exports.CreateCanvasImageElementFn = CreateCanvasImageElementFn;
132
- function CreateSelectionRectFn(fabric) {
130
+ function CreateSelectionRectFn() {
133
131
  var _a, _b;
134
132
  var _ = this;
135
133
  if (!_.canvasDataSource) {
136
134
  return;
137
135
  }
138
- _.createSelectionRectDataSource = new fabric.Rect({
136
+ _.createSelectionRectDataSource = new fabric_1.fabric.Rect({
139
137
  left: (_a = _.mousePointerDataSource) === null || _a === void 0 ? void 0 : _a.x,
140
138
  top: (_b = _.mousePointerDataSource) === null || _b === void 0 ? void 0 : _b.y,
141
139
  width: 0,
@@ -161,7 +159,7 @@ function CreateAllSelectionRectFn(fabric) {
161
159
  return;
162
160
  }
163
161
  var container = (0, utils_1.getDomFn)("canvasContainer");
164
- console.log("xxx---", _.canvasDataSource.getWidth());
162
+ // console.log("xxx---",_.canvasDataSource.getWidth());
165
163
  var containerWidth = container.offsetWidth;
166
164
  var containerHeight = container.offsetWidth;
167
165
  _.createSelectionRectDataSource = new fabric.Rect({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
- "version": "1.6.58",
3
+ "version": "1.6.60",
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",