xctc-utils 1.6.51 → 1.6.52

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.
@@ -1,3 +1,4 @@
1
+ import { QuerySelectionAllElementsFn, QueryCanvasActionDataFn } from "../handle/query";
1
2
  export default class CanvasHooks {
2
3
  canvasDataSource: any;
3
4
  zoomDataSource: string;
@@ -35,7 +36,7 @@ export default class CanvasHooks {
35
36
  canvasConfigDataFn(config: any): void;
36
37
  registerCallBackEventFn(config?: any): void;
37
38
  registerAllEventHandleFn(): void;
38
- registerCanvasZoomChangeEventFn(): any;
39
+ registerCanvasZoomChangeEventFn(): void;
39
40
  registerMouseDropEventFn(options: any): void;
40
41
  registerMouseOverEventFn(options: any): void;
41
42
  registerMouseOutEventFn(options: any): void;
@@ -50,22 +51,25 @@ export default class CanvasHooks {
50
51
  getCreateElementStatusFn(index: any): void;
51
52
  createCanvasSvgElementFn(item: any, index?: number): void;
52
53
  createCanvasImageElementFn(item: any, index?: number): void;
53
- getSelectionAllElementsFn(): any;
54
- getSelectionElementsFn(item: any): any;
54
+ getSelectionAllElementsFn(): typeof QuerySelectionAllElementsFn;
55
+ getSelectionElementsFn(item: any): () => any;
55
56
  createSelectionRectFn(): void;
56
57
  createAllSelectionRectFn(): void;
57
58
  removeAllSelectionRectFn(): void;
58
59
  updateSelectionRectFn(options: any): void;
59
60
  createSelectionRectFinishFn(): void;
60
61
  init(): void;
61
- elementSizeFn(id: string): any;
62
+ elementSizeFn(id: string): () => string | {
63
+ width: number;
64
+ height: number;
65
+ } | undefined;
62
66
  createRightClickMenuFn(options: any): void;
63
67
  hiddenRightClickMenuFn(): void;
64
- createElementFn(domVal: any, id: string, index?: number): any;
68
+ createElementFn(domVal: any, id: string, index?: number): () => void;
65
69
  previousStepFn(): void;
66
70
  removeElementFn(id: any): void;
67
71
  removeAllElementFn(): void;
68
72
  resetElementSizeFn(): void;
69
73
  setCanvasBaseConfigFn(zoom: any): void;
70
- getCanvasActionDataFn(): any;
74
+ getCanvasActionDataFn(): typeof QueryCanvasActionDataFn;
71
75
  }
@@ -187,7 +187,8 @@ var CanvasHooks = /** @class */ (function () {
187
187
  };
188
188
  // 注册回调事件--页面生成画布实例的时候,调用该函数
189
189
  CanvasHooks.prototype.registerCallBackEventFn = function (config) {
190
- new register_1.RegisterCanvasEventFn(config);
190
+ var _ = this;
191
+ register_1.RegisterCanvasEventFn.bind(_, config);
191
192
  };
192
193
  // 执行注册事件
193
194
  CanvasHooks.prototype.registerAllEventHandleFn = function () {
@@ -232,15 +233,16 @@ var CanvasHooks = /** @class */ (function () {
232
233
  };
233
234
  // 注册画布发生缩放监听事件
234
235
  CanvasHooks.prototype.registerCanvasZoomChangeEventFn = function () {
235
- return new register_1.RegisterCanvasZoomChangeEventFn();
236
+ var _ = this;
237
+ register_1.RegisterCanvasZoomChangeEventFn.bind(_);
236
238
  };
237
239
  // 拖拽事件注册
238
240
  CanvasHooks.prototype.registerMouseDropEventFn = function (options) {
239
- new drop_1.RegisterMouseDropEventFn(options);
241
+ var _ = this;
242
+ drop_1.RegisterMouseDropEventFn.bind(_, options);
240
243
  };
241
244
  // 鼠标进入画布
242
245
  CanvasHooks.prototype.registerMouseOverEventFn = function (options) {
243
- // console.log("registerMouseOutEventFn");
244
246
  var _ = this;
245
247
  _.mouseCanvasInRangeStatus = true;
246
248
  };
@@ -252,35 +254,43 @@ var CanvasHooks = /** @class */ (function () {
252
254
  };
253
255
  // 注册鼠标按下事件
254
256
  CanvasHooks.prototype.registerMouseDownEventFn = function (options) {
255
- new mouse_down_1.RegisterMouseDownEventFn(options);
257
+ var _ = this;
258
+ mouse_down_1.RegisterMouseDownEventFn.bind(_, options);
256
259
  };
257
260
  // 注册鼠标移动事件
258
261
  CanvasHooks.prototype.registerMouseMoveEventFn = function (options) {
259
- new mouse_move_1.RegisterMouseMoveEventFn(options);
262
+ var _ = this;
263
+ mouse_move_1.RegisterMouseMoveEventFn.bind(_, options);
260
264
  };
261
265
  // 注册鼠标抬起事件
262
266
  CanvasHooks.prototype.registerMouseUpEventFn = function (options) {
263
- new mouse_up_1.RegisterMouseUpEventFn(options);
267
+ var _ = this;
268
+ mouse_up_1.RegisterMouseUpEventFn.bind(_, options);
264
269
  };
265
270
  // 注册鼠标滚动事件
266
271
  CanvasHooks.prototype.registerMouseWheelEventFn = function (options) {
267
- new mouse_wheel_1.RegisterMouseWheelEventFn(options);
272
+ var _ = this;
273
+ mouse_wheel_1.RegisterMouseWheelEventFn.bind(_, options);
268
274
  };
269
275
  // 滚动事件操作--画布缩放监听
270
276
  CanvasHooks.prototype.registerZoomHandleFn = function (options) {
271
- new index_1.RegisterZoomHandleFn(options);
277
+ var _ = this;
278
+ index_1.RegisterZoomHandleFn.bind(_, options);
272
279
  };
273
280
  // 页面上发生拖拽时,拖拽完成后的数据存储函数
274
281
  CanvasHooks.prototype.dragCreateElementDataFn = function (data) {
275
- new drop_2.DragCreateElementDataFn(data);
282
+ var _ = this;
283
+ drop_2.DragCreateElementDataFn.bind(_, data);
276
284
  };
277
285
  // 拖拽进入画布元素创建
278
286
  CanvasHooks.prototype.createDragElementFn = function () {
279
- new create_1.CreateDragElementFn();
287
+ var _ = this;
288
+ create_1.CreateDragElementFn.bind(_);
280
289
  };
281
290
  // 默认加载一个列表数据到画布
282
291
  CanvasHooks.prototype.initElement2CanvasFn = function (list) {
283
- new create_1.InitElement2CanvasFn(list);
292
+ var _ = this;
293
+ create_1.InitElement2CanvasFn.bind(_, list);
284
294
  };
285
295
  CanvasHooks.prototype.getCreateElementStatusFn = function (index) {
286
296
  var _ = this;
@@ -295,80 +305,99 @@ var CanvasHooks = /** @class */ (function () {
295
305
  };
296
306
  // 创建SVG到画布
297
307
  CanvasHooks.prototype.createCanvasSvgElementFn = function (item, index) {
298
- new create_1.CreateCanvasSvgElementFn(fabric_1.fabric, item, index);
308
+ var _ = this;
309
+ create_1.CreateCanvasSvgElementFn.bind(_, fabric_1.fabric, item, index);
299
310
  };
300
311
  // 创建图片到画布
301
312
  CanvasHooks.prototype.createCanvasImageElementFn = function (item, index) {
302
- new create_1.CreateCanvasImageElementFn(fabric_1.fabric, item, index);
313
+ var _ = this;
314
+ create_1.CreateCanvasImageElementFn.bind(_, fabric_1.fabric, item, index);
303
315
  };
304
316
  // 获取到所有被框选的对象
305
317
  CanvasHooks.prototype.getSelectionAllElementsFn = function () {
306
- return new query_1.QuerySelectionAllElementsFn();
318
+ var _ = this;
319
+ return query_1.QuerySelectionAllElementsFn.bind(_);
307
320
  };
308
321
  // 获取到指定选择框内被框选的对象
309
322
  CanvasHooks.prototype.getSelectionElementsFn = function (item) {
310
- return new query_1.QuerySelectionElementsFn(item);
323
+ var _ = this;
324
+ return query_1.QuerySelectionElementsFn.bind(_, item);
311
325
  };
312
326
  // 创建自定义图像
313
327
  CanvasHooks.prototype.createSelectionRectFn = function () {
314
- new create_1.CreateSelectionRectFn(fabric_1.fabric);
328
+ var _ = this;
329
+ create_1.CreateSelectionRectFn.bind(_, fabric_1.fabric);
315
330
  };
316
331
  // 创建全选框
317
332
  CanvasHooks.prototype.createAllSelectionRectFn = function () {
318
- new create_1.CreateAllSelectionRectFn(fabric_1.fabric);
333
+ var _ = this;
334
+ create_1.CreateAllSelectionRectFn.bind(_, fabric_1.fabric);
319
335
  };
320
336
  // 删除全选对象选择框
321
337
  CanvasHooks.prototype.removeAllSelectionRectFn = function () {
322
- new update_1.RemoveAllSelectionRectFn();
338
+ var _ = this;
339
+ update_1.RemoveAllSelectionRectFn.bind(_);
323
340
  };
324
341
  // 自定义选择框绘制数据更新
325
342
  CanvasHooks.prototype.updateSelectionRectFn = function (options) {
326
- new update_1.UpdateSelectionRectFn(options);
343
+ var _ = this;
344
+ update_1.UpdateSelectionRectFn.bind(_, options);
327
345
  };
328
346
  // 自定义选择框绘制完成
329
347
  CanvasHooks.prototype.createSelectionRectFinishFn = function () {
330
- new update_1.CreateSelectionRectFinishFn();
348
+ var _ = this;
349
+ update_1.CreateSelectionRectFinishFn.bind(_);
331
350
  };
332
351
  CanvasHooks.prototype.init = function () {
333
352
  var _ = this;
334
353
  };
335
354
  // 获取画布容器的宽高
336
355
  CanvasHooks.prototype.elementSizeFn = function (id) {
337
- return new query_1.QueryElementSizeFn(id);
356
+ var _ = this;
357
+ return query_1.QueryElementSizeFn.bind(_, id);
338
358
  };
339
359
  // 右键菜单管理
340
360
  CanvasHooks.prototype.createRightClickMenuFn = function (options) {
341
- new create_1.CreateRightClickMenuFn(options);
361
+ var _ = this;
362
+ create_1.CreateRightClickMenuFn.bind(_, options);
342
363
  };
343
364
  CanvasHooks.prototype.hiddenRightClickMenuFn = function () {
344
- new update_1.HiddenRightClickMenuFn();
365
+ var _ = this;
366
+ update_1.HiddenRightClickMenuFn.bind(_);
345
367
  };
346
368
  // 在画布上动态创建对象
347
369
  CanvasHooks.prototype.createElementFn = function (domVal, id, index) {
348
- return new create_1.CreateElementFn(domVal, id, index);
370
+ var _ = this;
371
+ return create_1.CreateElementFn.bind(_, domVal, id, index);
349
372
  };
350
373
  // 执行返回上一步操作
351
374
  CanvasHooks.prototype.previousStepFn = function () {
352
- new changed_1.PreviousStepFn();
375
+ var _ = this;
376
+ changed_1.PreviousStepFn.bind(_);
353
377
  };
354
378
  // 移除画布上指定对象
355
379
  CanvasHooks.prototype.removeElementFn = function (id) {
356
- new update_1.RemoveElementFn(id);
380
+ var _ = this;
381
+ update_1.RemoveElementFn.bind(_, id);
357
382
  };
358
383
  // 清空画布上所有对象
359
384
  CanvasHooks.prototype.removeAllElementFn = function () {
360
- new update_1.RemoveAllElementFn();
385
+ var _ = this;
386
+ update_1.RemoveAllElementFn.bind(_);
361
387
  };
362
388
  // 对于画布出现缩放的情况,加载进入的数据会产生偏移处理
363
389
  // 问题未解决,备注
364
390
  CanvasHooks.prototype.resetElementSizeFn = function () {
365
- new changed_1.ResetElementSizeFn();
391
+ var _ = this;
392
+ changed_1.ResetElementSizeFn.bind(_);
366
393
  };
367
394
  CanvasHooks.prototype.setCanvasBaseConfigFn = function (zoom) {
368
- new index_1.SetCanvasBaseConfigFn(zoom);
395
+ var _ = this;
396
+ index_1.SetCanvasBaseConfigFn.bind(_, zoom);
369
397
  };
370
398
  CanvasHooks.prototype.getCanvasActionDataFn = function () {
371
- return new query_1.QueryCanvasActionDataFn();
399
+ var _ = this;
400
+ return query_1.QueryCanvasActionDataFn.bind(_);
372
401
  };
373
402
  return CanvasHooks;
374
403
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
- "version": "1.6.51",
3
+ "version": "1.6.52",
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",