xctc-utils 1.6.52 → 1.6.54

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