xctc-utils 1.6.59 → 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
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,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
- _.createCanvasSvgElementFn(item);
37
+ _.CreateCanvasSvgElementFn(item);
37
38
  }
38
39
  else {
39
- _.createCanvasImageElementFn(item);
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
- _.createCanvasSvgElementFn(item, index);
59
+ _.CreateCanvasSvgElementFn(item, index);
59
60
  }
60
61
  else {
61
- _.createCanvasImageElementFn(item, index);
62
+ _.CreateCanvasImageElementFn(item, index);
62
63
  }
63
64
  }
64
65
  });
65
66
  }
66
67
  }
67
68
  exports.InitElement2CanvasFn = InitElement2CanvasFn;
68
- function CreateCanvasSvgElementFn(fabric, item, index) {
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(fabric, item, index) {
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(fabric) {
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,
@@ -158,7 +159,7 @@ function CreateAllSelectionRectFn(fabric) {
158
159
  return;
159
160
  }
160
161
  var container = (0, utils_1.getDomFn)("canvasContainer");
161
- console.log("xxx---", _.canvasDataSource.getWidth());
162
+ // console.log("xxx---",_.canvasDataSource.getWidth());
162
163
  var containerWidth = container.offsetWidth;
163
164
  var containerHeight = container.offsetWidth;
164
165
  _.createSelectionRectDataSource = new fabric.Rect({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
- "version": "1.6.59",
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",