xctc-utils 1.6.68 → 1.6.69

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,38 +1,26 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
- var config_1 = require("../config");
15
- var utils_1 = require("../utils");
16
- var is_1 = require("../is");
17
- var has_1 = require("../is/has");
18
- var register_1 = require("../handle/register");
19
- var drop_1 = require("../event/drop");
20
- var mouse_down_1 = require("../event/mouse-down");
21
- var mouse_move_1 = require("../event/mouse-move");
22
- var mouse_up_1 = require("../event/mouse-up");
23
- var mouse_wheel_1 = require("../event/mouse-wheel");
24
- var index_1 = require("../handle/index");
25
- var drop_2 = require("../event/drop");
26
- var create_1 = require("../handle/create");
27
- var query_1 = require("../handle/query");
28
- var update_1 = require("../handle/update");
29
- var changed_1 = require("../event/changed");
30
- var index_2 = require("../event/index");
3
+ const config_1 = require("../config");
4
+ const utils_1 = require("../utils");
5
+ const is_1 = require("../is");
6
+ const has_1 = require("../is/has");
7
+ const register_1 = require("../handle/register");
8
+ const drop_1 = require("../event/drop");
9
+ const mouse_down_1 = require("../event/mouse-down");
10
+ const mouse_move_1 = require("../event/mouse-move");
11
+ const mouse_up_1 = require("../event/mouse-up");
12
+ const mouse_wheel_1 = require("../event/mouse-wheel");
13
+ const index_1 = require("../handle/index");
14
+ const drop_2 = require("../event/drop");
15
+ const create_1 = require("../handle/create");
16
+ const query_1 = require("../handle/query");
17
+ const update_1 = require("../handle/update");
18
+ const changed_1 = require("../event/changed");
19
+ const index_2 = require("../event/index");
31
20
  // 初始化画布创建时需要的参数-默认值
32
- var defaultConfig = __assign({}, config_1.configDefaultValue.canvasDefaultValue);
33
- var CanvasHooks = /** @class */ (function () {
34
- function CanvasHooks(config) {
35
- var _this = this;
21
+ const defaultConfig = { ...config_1.configDefaultValue.canvasDefaultValue };
22
+ class CanvasHooks {
23
+ constructor(config) {
36
24
  this.fabricSource = null;
37
25
  this.fabricUrlSource = "https://cdn.bootcss.com/fabric.js/4.0.0-beta.5/fabric.min.js";
38
26
  this.canvasDataSource = null;
@@ -64,30 +52,26 @@ var CanvasHooks = /** @class */ (function () {
64
52
  this.mouseWheelStatus = false;
65
53
  this.defaultCreateDataListStatus = false;
66
54
  this.mouseCanvasInRangeStatus = false;
67
- var url = this.fabricUrlSource;
55
+ const url = this.fabricUrlSource;
68
56
  if (config === null || config === void 0 ? void 0 : config.init) {
69
- (0, utils_1.loadScript)(url, function () {
57
+ (0, utils_1.loadScript)(url, () => {
70
58
  // 是否默认加载画布
71
- _this.createCanvasFn();
59
+ this.createCanvasFn();
72
60
  });
73
61
  }
74
62
  else {
75
63
  (0, utils_1.loadScript)(url);
76
64
  }
77
65
  }
78
- Object.defineProperty(CanvasHooks.prototype, "canvasConfigData", {
79
- get: function () {
80
- return this.canvasConfig;
81
- },
82
- enumerable: false,
83
- configurable: true
84
- });
66
+ get canvasConfigData() {
67
+ return this.canvasConfig;
68
+ }
85
69
  // 创建画布
86
- CanvasHooks.prototype.createCanvasFn = function (config) {
70
+ createCanvasFn(config) {
87
71
  var _a;
88
- var _ = this;
72
+ const _ = this;
89
73
  _.renderCanvasStatus = 1;
90
- var canvasId = "";
74
+ let canvasId = "";
91
75
  // config 配置数据必须有画布ID参数
92
76
  if ((0, is_1.isObject)(config) && !(0, has_1.hasProperty)(config, "id")) {
93
77
  console.error("createCanvasFn函数接收的参数必须包含画布对应的id");
@@ -101,16 +85,19 @@ var CanvasHooks = /** @class */ (function () {
101
85
  }
102
86
  }
103
87
  // 初始化画布渲染时的配置参数
104
- var data = __assign(__assign({}, defaultConfig), _.canvasConfig);
88
+ const data = {
89
+ ...defaultConfig,
90
+ ..._.canvasConfig
91
+ };
105
92
  if (!(0, has_1.hasProperty)(_.canvasConfig, "width")) {
106
93
  data['width'] = _.elementSizeFn("canvasContainer").width;
107
94
  }
108
95
  if (!(0, has_1.hasProperty)(_.canvasConfig, "height")) {
109
96
  data['height'] = _.elementSizeFn("canvasContainer").height;
110
97
  }
111
- var imgUrl = (data === null || data === void 0 ? void 0 : data.backgroundImgUrl) || "";
98
+ const imgUrl = (data === null || data === void 0 ? void 0 : data.backgroundImgUrl) || "";
112
99
  canvasId = data.id;
113
- var url = _.fabricUrlSource;
100
+ let url = _.fabricUrlSource;
114
101
  if ((_a = _.canvasConfig) === null || _a === void 0 ? void 0 : _a.fabricUrlSource) {
115
102
  url = _.canvasConfig.fabricUrlSource;
116
103
  }
@@ -118,39 +105,39 @@ var CanvasHooks = /** @class */ (function () {
118
105
  url = config.fabricUrlSource;
119
106
  }
120
107
  if (!(0, utils_1.isScriptLoaded)(url)) {
121
- (0, utils_1.loadScript)(url, function () {
108
+ (0, utils_1.loadScript)(url, () => {
122
109
  _.initCanvasDataFn(imgUrl, canvasId, data);
123
110
  });
124
111
  }
125
112
  else {
126
113
  _.initCanvasDataFn(imgUrl, canvasId, data);
127
114
  }
128
- };
129
- CanvasHooks.prototype.initCanvasDataFn = function (imgUrl, canvasId, data) {
130
- var _ = this;
131
- var win = window;
115
+ }
116
+ initCanvasDataFn(imgUrl, canvasId, data) {
117
+ const _ = this;
118
+ const win = window;
132
119
  _.fabricSource = (win === null || win === void 0 ? void 0 : win.fabric) || {};
133
120
  if (imgUrl) {
134
121
  _.fabricSource.Image.fromURL(imgUrl, function (img) {
135
122
  _.renderCanvasStatus = 2;
136
123
  _.canvasBackgroundImageTarget = img;
137
- var _a = _.canvasConfig.actions, actions = _a === void 0 ? "" : _a;
138
- var zoomValue = (actions === null || actions === void 0 ? void 0 : actions.zoom) || 1;
124
+ const { actions = "" } = _.canvasConfig;
125
+ const zoomValue = (actions === null || actions === void 0 ? void 0 : actions.zoom) || 1;
139
126
  if (!_.canvasDataSource) {
140
- _.canvasDataSource = new _.fabricSource.Canvas(canvasId, __assign({}, data));
127
+ _.canvasDataSource = new _.fabricSource.Canvas(canvasId, { ...data });
141
128
  if (zoomValue != 1) {
142
129
  _.canvasDataSource.setZoom(zoomValue);
143
130
  }
144
131
  }
145
- var canvasWidth = _.canvasDataSource.getWidth();
146
- var canvasHeight = _.canvasDataSource.getHeight();
147
- var imgWidth = img.width;
148
- var imgHeight = img.height;
149
- var scaleX = 1;
150
- var scaleY = 1;
132
+ const canvasWidth = _.canvasDataSource.getWidth();
133
+ const canvasHeight = _.canvasDataSource.getHeight();
134
+ const imgWidth = img.width;
135
+ const imgHeight = img.height;
136
+ let scaleX = 1;
137
+ let scaleY = 1;
151
138
  if (canvasWidth && canvasHeight && imgWidth && imgHeight) {
152
- var imageAspectRatio = imgWidth / imgHeight;
153
- var canvasAspectRatio = canvasWidth / canvasHeight;
139
+ let imageAspectRatio = imgWidth / imgHeight;
140
+ let canvasAspectRatio = canvasWidth / canvasHeight;
154
141
  if (imageAspectRatio > canvasAspectRatio) {
155
142
  // 图片更宽,基于高度缩放
156
143
  scaleY = canvasHeight / imgHeight;
@@ -181,7 +168,7 @@ var CanvasHooks = /** @class */ (function () {
181
168
  }
182
169
  else {
183
170
  if (!_.canvasDataSource) {
184
- _.canvasDataSource = new _.fabricSource.Canvas(canvasId, __assign({}, data));
171
+ _.canvasDataSource = new _.fabricSource.Canvas(canvasId, { ...data });
185
172
  _.renderCanvasStatus = 3;
186
173
  _.registerAllEventHandleFn();
187
174
  _.canvasDataSource.renderAll();
@@ -191,42 +178,42 @@ var CanvasHooks = /** @class */ (function () {
191
178
  // 如果配置里面有回调函数,则将当前画布数据对象返回
192
179
  function callBack(data) {
193
180
  var _a;
194
- var cb = ((_a = _.canvasConfig) === null || _a === void 0 ? void 0 : _a.cb) || "";
181
+ const cb = ((_a = _.canvasConfig) === null || _a === void 0 ? void 0 : _a.cb) || "";
195
182
  // 获取DOM元素
196
- var targetElement = (0, utils_1.getDomFn)("canvasContainer");
183
+ const targetElement = (0, utils_1.getDomFn)("canvasContainer");
197
184
  // 添加事件监听器
198
185
  document.addEventListener('mousemove', (0, index_2.checkMouseInElement)(targetElement));
199
186
  if (cb instanceof Function) {
200
187
  cb(data);
201
188
  }
202
189
  }
203
- };
190
+ }
204
191
  // 销毁画布
205
- CanvasHooks.prototype.disposeCanvasFn = function () {
192
+ disposeCanvasFn() {
206
193
  var _a, _b;
207
194
  if (this.canvasDataSource) {
208
- var el = (_a = this.canvasDataSource) === null || _a === void 0 ? void 0 : _a.getElement();
195
+ const el = (_a = this.canvasDataSource) === null || _a === void 0 ? void 0 : _a.getElement();
209
196
  (_b = this.canvasDataSource) === null || _b === void 0 ? void 0 : _b.dispose();
210
197
  el === null || el === void 0 ? void 0 : el.remove(); // 删除canvasDataSource元素
211
198
  this.canvasDataSource = null;
212
199
  }
213
- };
200
+ }
214
201
  // 关于画布相关配置数据
215
- CanvasHooks.prototype.canvasConfigDataFn = function (config) {
202
+ canvasConfigDataFn(config) {
216
203
  /**
217
204
  * rightButtonsDataSource 画布右键菜单列表数据
218
205
  */
219
206
  this.canvasHandleConfig = config || {};
220
- };
207
+ }
221
208
  // 注册回调事件--页面生成画布实例的时候,调用该函数
222
- CanvasHooks.prototype.registerCallBackEventFn = function (config) {
223
- var _ = this;
224
- var boundFunction = register_1.RegisterCanvasEventFn.bind(_, config);
209
+ registerCallBackEventFn(config) {
210
+ const _ = this;
211
+ const boundFunction = register_1.RegisterCanvasEventFn.bind(_, config);
225
212
  boundFunction();
226
- };
213
+ }
227
214
  // 执行注册事件
228
- CanvasHooks.prototype.registerAllEventHandleFn = function () {
229
- var _ = this;
215
+ registerAllEventHandleFn() {
216
+ const _ = this;
230
217
  _.dragLastPosDataSource = {
231
218
  open: false,
232
219
  lastPosX: null,
@@ -254,14 +241,14 @@ var CanvasHooks = /** @class */ (function () {
254
241
  _.registerMouseUpEventFn(options);
255
242
  });
256
243
  // 注册滚动事件
257
- _.canvasDataSource.on('mouse:wheel', function (options) {
244
+ _.canvasDataSource.on('mouse:wheel', (options) => {
258
245
  _.registerMouseWheelEventFn(options);
259
246
  });
260
- _.canvasDataSource.on('drop', function (options) {
247
+ _.canvasDataSource.on('drop', (options) => {
261
248
  _.registerMouseDropEventFn(options);
262
249
  });
263
250
  //监听画布缩放状态
264
- _.canvasDataSource.on('zoom:changed', function (options) {
251
+ _.canvasDataSource.on('zoom:changed', (options) => {
265
252
  _.registerCanvasZoomChangeEventFn(options);
266
253
  });
267
254
  _.canvasDataSource.on('contextmenu', function (options) {
@@ -273,206 +260,205 @@ var CanvasHooks = /** @class */ (function () {
273
260
  document.body.addEventListener('contextmenu', function (event) {
274
261
  event === null || event === void 0 ? void 0 : event.preventDefault();
275
262
  });
276
- };
263
+ }
277
264
  // 注册画布发生缩放监听事件
278
- CanvasHooks.prototype.registerCanvasZoomChangeEventFn = function () {
279
- var _ = this;
280
- var boundFunction = register_1.RegisterCanvasZoomChangeEventFn.bind(_);
265
+ registerCanvasZoomChangeEventFn() {
266
+ const _ = this;
267
+ const boundFunction = register_1.RegisterCanvasZoomChangeEventFn.bind(_);
281
268
  boundFunction();
282
- };
269
+ }
283
270
  // 拖拽事件注册
284
- CanvasHooks.prototype.registerMouseDropEventFn = function (options) {
285
- var _ = this;
286
- var boundFunction = drop_1.RegisterMouseDropEventFn.bind(_, options);
271
+ registerMouseDropEventFn(options) {
272
+ const _ = this;
273
+ const boundFunction = drop_1.RegisterMouseDropEventFn.bind(_, options);
287
274
  boundFunction();
288
- };
275
+ }
289
276
  // 鼠标进入画布
290
- CanvasHooks.prototype.registerMouseOverEventFn = function (options) {
291
- var _ = this;
277
+ registerMouseOverEventFn(options) {
278
+ const _ = this;
292
279
  _.mouseCanvasInRangeStatus = true;
293
- };
280
+ }
294
281
  // 鼠标移出画布
295
- CanvasHooks.prototype.registerMouseOutEventFn = function (options) {
282
+ registerMouseOutEventFn(options) {
296
283
  // console.log("registerMouseOutEventFn");
297
- var _ = this;
284
+ const _ = this;
298
285
  _.mouseCanvasInRangeStatus = false;
299
- };
286
+ }
300
287
  // 注册鼠标按下事件
301
- CanvasHooks.prototype.registerMouseDownEventFn = function (options) {
302
- var _ = this;
303
- var boundFunction = mouse_down_1.RegisterMouseDownEventFn.bind(_, options);
288
+ registerMouseDownEventFn(options) {
289
+ const _ = this;
290
+ const boundFunction = mouse_down_1.RegisterMouseDownEventFn.bind(_, options);
304
291
  boundFunction();
305
- };
292
+ }
306
293
  // 注册鼠标移动事件
307
- CanvasHooks.prototype.registerMouseMoveEventFn = function (options) {
308
- var _ = this;
309
- var boundFunction = mouse_move_1.RegisterMouseMoveEventFn.bind(_, options);
294
+ registerMouseMoveEventFn(options) {
295
+ const _ = this;
296
+ const boundFunction = mouse_move_1.RegisterMouseMoveEventFn.bind(_, options);
310
297
  boundFunction();
311
- };
298
+ }
312
299
  // 注册鼠标抬起事件
313
- CanvasHooks.prototype.registerMouseUpEventFn = function (options) {
314
- var _ = this;
315
- var boundFunction = mouse_up_1.RegisterMouseUpEventFn.bind(_, options);
300
+ registerMouseUpEventFn(options) {
301
+ const _ = this;
302
+ const boundFunction = mouse_up_1.RegisterMouseUpEventFn.bind(_, options);
316
303
  boundFunction();
317
- };
304
+ }
318
305
  // 注册鼠标滚动事件
319
- CanvasHooks.prototype.registerMouseWheelEventFn = function (options) {
320
- var _ = this;
321
- var boundFunction = mouse_wheel_1.RegisterMouseWheelEventFn.bind(_, options);
306
+ registerMouseWheelEventFn(options) {
307
+ const _ = this;
308
+ const boundFunction = mouse_wheel_1.RegisterMouseWheelEventFn.bind(_, options);
322
309
  boundFunction();
323
- };
310
+ }
324
311
  // 滚动事件操作--画布缩放监听
325
- CanvasHooks.prototype.registerZoomHandleFn = function (options) {
326
- var _ = this;
327
- var boundFunction = index_1.RegisterZoomHandleFn.bind(_, options);
312
+ registerZoomHandleFn(options) {
313
+ const _ = this;
314
+ const boundFunction = index_1.RegisterZoomHandleFn.bind(_, options);
328
315
  boundFunction();
329
- };
316
+ }
330
317
  // 页面上发生拖拽时,拖拽完成后的数据存储函数
331
- CanvasHooks.prototype.dragCreateElementDataFn = function (data) {
332
- var _ = this;
333
- var boundFunction = drop_2.DragCreateElementDataFn.bind(_, data);
318
+ dragCreateElementDataFn(data) {
319
+ const _ = this;
320
+ const boundFunction = drop_2.DragCreateElementDataFn.bind(_, data);
334
321
  boundFunction();
335
- };
322
+ }
336
323
  // 拖拽进入画布元素创建
337
- CanvasHooks.prototype.createDragElementFn = function () {
338
- var _ = this;
339
- var boundFunction = create_1.CreateDragElementFn.bind(_);
324
+ createDragElementFn() {
325
+ const _ = this;
326
+ const boundFunction = create_1.CreateDragElementFn.bind(_);
340
327
  boundFunction();
341
- };
328
+ }
342
329
  // 默认加载一个列表数据到画布
343
- CanvasHooks.prototype.initElement2CanvasFn = function (list) {
344
- var _ = this;
345
- var boundFunction = create_1.InitElement2CanvasFn.bind(_, list);
330
+ initElement2CanvasFn(list) {
331
+ const _ = this;
332
+ const boundFunction = create_1.InitElement2CanvasFn.bind(_, list);
346
333
  boundFunction();
347
- };
348
- CanvasHooks.prototype.getCreateElementStatusFn = function (index) {
349
- var _ = this;
350
- var list = _.defaultCreateDataList;
334
+ }
335
+ getCreateElementStatusFn(index) {
336
+ const _ = this;
337
+ const list = _.defaultCreateDataList;
351
338
  if (index >= 0 && (list === null || list === void 0 ? void 0 : list.length)) {
352
339
  if (index == list.length - 1) {
353
- setTimeout(function () {
340
+ setTimeout(() => {
354
341
  _.resetElementSizeFn();
355
342
  }, 100);
356
343
  }
357
344
  }
358
- };
345
+ }
359
346
  // 创建SVG到画布
360
- CanvasHooks.prototype.createCanvasSvgElementFn = function (item, index) {
361
- var _ = this;
362
- var boundFunction = create_1.CreateCanvasSvgElementFn.bind(_, item, index);
347
+ createCanvasSvgElementFn(item, index) {
348
+ const _ = this;
349
+ const boundFunction = create_1.CreateCanvasSvgElementFn.bind(_, item, index);
363
350
  boundFunction();
364
- };
351
+ }
365
352
  // 创建图片到画布
366
- CanvasHooks.prototype.createCanvasImageElementFn = function (item, index) {
367
- var _ = this;
368
- var boundFunction = create_1.CreateCanvasImageElementFn.bind(_, item, index);
353
+ createCanvasImageElementFn(item, index) {
354
+ const _ = this;
355
+ const boundFunction = create_1.CreateCanvasImageElementFn.bind(_, item, index);
369
356
  boundFunction();
370
- };
357
+ }
371
358
  // 获取到所有被框选的对象
372
- CanvasHooks.prototype.getSelectionAllElementsFn = function () {
373
- var _ = this;
374
- var data = query_1.QuerySelectionAllElementsFn.bind(_);
359
+ getSelectionAllElementsFn() {
360
+ const _ = this;
361
+ const data = query_1.QuerySelectionAllElementsFn.bind(_);
375
362
  return data();
376
- };
363
+ }
377
364
  // 获取到指定选择框内被框选的对象
378
- CanvasHooks.prototype.getSelectionElementsFn = function (item) {
379
- var _ = this;
380
- var data = query_1.QuerySelectionElementsFn.bind(_, item);
365
+ getSelectionElementsFn(item) {
366
+ const _ = this;
367
+ const data = query_1.QuerySelectionElementsFn.bind(_, item);
381
368
  return data();
382
- };
369
+ }
383
370
  // 创建自定义图像
384
- CanvasHooks.prototype.createSelectionRectFn = function () {
385
- var _ = this;
386
- var boundFunction = create_1.CreateSelectionRectFn.bind(_);
371
+ createSelectionRectFn() {
372
+ const _ = this;
373
+ const boundFunction = create_1.CreateSelectionRectFn.bind(_);
387
374
  boundFunction();
388
- };
375
+ }
389
376
  // 创建全选框
390
- CanvasHooks.prototype.createAllSelectionRectFn = function () {
391
- var _ = this;
392
- var boundFunction = create_1.CreateAllSelectionRectFn.bind(_);
377
+ createAllSelectionRectFn() {
378
+ const _ = this;
379
+ const boundFunction = create_1.CreateAllSelectionRectFn.bind(_);
393
380
  boundFunction();
394
- };
381
+ }
395
382
  // 删除全选对象选择框
396
- CanvasHooks.prototype.removeAllSelectionRectFn = function () {
397
- var _ = this;
398
- var boundFunction = update_1.RemoveAllSelectionRectFn.bind(_);
383
+ removeAllSelectionRectFn() {
384
+ const _ = this;
385
+ const boundFunction = update_1.RemoveAllSelectionRectFn.bind(_);
399
386
  boundFunction();
400
- };
387
+ }
401
388
  // 自定义选择框绘制数据更新
402
- CanvasHooks.prototype.updateSelectionRectFn = function (options) {
403
- var _ = this;
404
- var boundFunction = update_1.UpdateSelectionRectFn.bind(_, options);
389
+ updateSelectionRectFn(options) {
390
+ const _ = this;
391
+ const boundFunction = update_1.UpdateSelectionRectFn.bind(_, options);
405
392
  boundFunction();
406
- };
393
+ }
407
394
  // 自定义选择框绘制完成
408
- CanvasHooks.prototype.createSelectionRectFinishFn = function () {
409
- var _ = this;
410
- var boundFunction = update_1.CreateSelectionRectFinishFn.bind(_);
395
+ createSelectionRectFinishFn() {
396
+ const _ = this;
397
+ const boundFunction = update_1.CreateSelectionRectFinishFn.bind(_);
411
398
  boundFunction();
412
- };
413
- CanvasHooks.prototype.init = function () {
414
- var _ = this;
415
- };
399
+ }
400
+ init() {
401
+ const _ = this;
402
+ }
416
403
  // 获取画布容器的宽高
417
- CanvasHooks.prototype.elementSizeFn = function (id) {
418
- var _ = this;
419
- var data = query_1.QueryElementSizeFn.bind(_, id);
420
- var result = data() || {};
404
+ elementSizeFn(id) {
405
+ const _ = this;
406
+ const data = query_1.QueryElementSizeFn.bind(_, id);
407
+ const result = data() || {};
421
408
  console.log("elementSizeFn--result==", result);
422
409
  return result;
423
- };
410
+ }
424
411
  // 右键菜单管理
425
- CanvasHooks.prototype.createRightClickMenuFn = function (options) {
426
- var _ = this;
427
- var boundFunction = create_1.CreateRightClickMenuFn.bind(_, options);
412
+ createRightClickMenuFn(options) {
413
+ const _ = this;
414
+ const boundFunction = create_1.CreateRightClickMenuFn.bind(_, options);
428
415
  boundFunction();
429
- };
430
- CanvasHooks.prototype.hiddenRightClickMenuFn = function () {
431
- var _ = this;
432
- var boundFunction = update_1.HiddenRightClickMenuFn.bind(_);
416
+ }
417
+ hiddenRightClickMenuFn() {
418
+ const _ = this;
419
+ const boundFunction = update_1.HiddenRightClickMenuFn.bind(_);
433
420
  boundFunction();
434
- };
421
+ }
435
422
  // 在画布上动态创建对象
436
- CanvasHooks.prototype.createElementFn = function (domVal, id, index) {
437
- var _ = this;
438
- var data = create_1.CreateElementFn.bind(_, domVal, id, index);
423
+ createElementFn(domVal, id, index) {
424
+ const _ = this;
425
+ const data = create_1.CreateElementFn.bind(_, domVal, id, index);
439
426
  return data();
440
- };
427
+ }
441
428
  // 执行返回上一步操作
442
- CanvasHooks.prototype.previousStepFn = function () {
443
- var _ = this;
444
- var boundFunction = changed_1.PreviousStepFn.bind(_);
429
+ previousStepFn() {
430
+ const _ = this;
431
+ const boundFunction = changed_1.PreviousStepFn.bind(_);
445
432
  boundFunction();
446
- };
433
+ }
447
434
  // 移除画布上指定对象
448
- CanvasHooks.prototype.removeElementFn = function (id) {
449
- var _ = this;
450
- var boundFunction = update_1.RemoveElementFn.bind(_, id);
435
+ removeElementFn(id) {
436
+ const _ = this;
437
+ const boundFunction = update_1.RemoveElementFn.bind(_, id);
451
438
  boundFunction();
452
- };
439
+ }
453
440
  // 清空画布上所有对象
454
- CanvasHooks.prototype.removeAllElementFn = function () {
455
- var _ = this;
456
- var boundFunction = update_1.RemoveAllElementFn.bind(_);
441
+ removeAllElementFn() {
442
+ const _ = this;
443
+ const boundFunction = update_1.RemoveAllElementFn.bind(_);
457
444
  boundFunction();
458
- };
445
+ }
459
446
  // 对于画布出现缩放的情况,加载进入的数据会产生偏移处理
460
447
  // 问题未解决,备注
461
- CanvasHooks.prototype.resetElementSizeFn = function () {
462
- var _ = this;
463
- var boundFunction = changed_1.ResetElementSizeFn.bind(_);
448
+ resetElementSizeFn() {
449
+ const _ = this;
450
+ const boundFunction = changed_1.ResetElementSizeFn.bind(_);
464
451
  boundFunction();
465
- };
466
- CanvasHooks.prototype.setCanvasBaseConfigFn = function (zoom) {
467
- var _ = this;
468
- var boundFunction = index_1.SetCanvasBaseConfigFn.bind(_, zoom);
452
+ }
453
+ setCanvasBaseConfigFn(zoom) {
454
+ const _ = this;
455
+ const boundFunction = index_1.SetCanvasBaseConfigFn.bind(_, zoom);
469
456
  boundFunction();
470
- };
471
- CanvasHooks.prototype.getCanvasActionDataFn = function () {
472
- var _ = this;
473
- var data = query_1.QueryCanvasActionDataFn.bind(_);
457
+ }
458
+ getCanvasActionDataFn() {
459
+ const _ = this;
460
+ const data = query_1.QueryCanvasActionDataFn.bind(_);
474
461
  return data();
475
- };
476
- return CanvasHooks;
477
- }());
462
+ }
463
+ }
478
464
  exports.default = CanvasHooks;