costy-plus 1.1.17-0 → 1.1.18-0

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.
@@ -4,7 +4,7 @@ import E from "../../node_modules/.pnpm/vue-class-component@7.2.6_vue@2.6.14/nod
4
4
  import "../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Emit.js";
5
5
  import { Prop as f } from "../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Prop.js";
6
6
  import { Text as O, Group as Y, Rect as y, Circle as F, init as j } from "zrender";
7
- import { calcMs as T, calcMV as $, calcBpm as k } from "@costy-plus/utils";
7
+ import { calcMs as k, calcMV as T, calcBpm as $ } from "@costy-plus/utils";
8
8
  var S = Object.defineProperty, G = Object.getOwnPropertyDescriptor, l = (t, e, s, h) => {
9
9
  for (var c = h > 1 ? void 0 : h ? G(e, s) : e, a = t.length - 1, i; a >= 0; a--)
10
10
  (i = t[a]) && (c = (h ? i(e, s, c) : i(c)) || c);
@@ -60,7 +60,7 @@ let o = class extends C {
60
60
  style: {
61
61
  stroke: this.config.circleLinestroke,
62
62
  lineWidth: this.config.circleLineW,
63
- fill: "transparent"
63
+ fill: "red"
64
64
  },
65
65
  shape: {
66
66
  width: 1,
@@ -74,7 +74,7 @@ let o = class extends C {
74
74
  style: {
75
75
  stroke: this.config.circleLinestroke,
76
76
  lineWidth: this.config.circleLineW,
77
- fill: "transparent"
77
+ fill: "black"
78
78
  },
79
79
  shape: {
80
80
  r: 12
@@ -115,16 +115,16 @@ let o = class extends C {
115
115
  }
116
116
  calcText() {
117
117
  var h, c, a, i, r, n, g, p;
118
- const t = T(
118
+ const t = k(
119
119
  ((h = this.rectIns) == null ? void 0 : h.shape.width) || 0,
120
120
  this.speedValue,
121
121
  this.cellMg,
122
122
  this.magnification
123
- ), e = $(
123
+ ), e = T(
124
124
  ((c = this.rectIns) == null ? void 0 : c.shape.height) || 0,
125
125
  this.sens,
126
126
  this.magnification
127
- ), s = t !== 0 && k(t) || 0;
127
+ ), s = t !== 0 && $(t) || 0;
128
128
  (p = this.textIns) == null || p.attr({
129
129
  style: {
130
130
  text: `${t} ms
@@ -196,32 +196,32 @@ let o = class extends C {
196
196
  x: (u = this.rectIns) == null ? void 0 : u.shape.x,
197
197
  y: t.offsetY - (((x = this.rectIns) == null ? void 0 : x.shape.y) || 0) + (((d = this.rectIns) == null ? void 0 : d.shape.y) || 0)
198
198
  }), this.circleList[4].attr({
199
- x: ((m = this.rectIns) == null ? void 0 : m.shape.x) + 1,
199
+ x: ((m = this.rectIns) == null ? void 0 : m.shape.x) + 12,
200
200
  y: ((I = this.rectIns) == null ? void 0 : I.shape.y) - 1,
201
201
  shape: {
202
- width: t.offsetX - this.rectIns.shape.x - 2,
202
+ width: t.offsetX - this.rectIns.shape.x - 24,
203
203
  height: 2
204
204
  }
205
205
  }), this.circleList[5].attr({
206
206
  x: t.offsetX - (((L = this.rectIns) == null ? void 0 : L.shape.x) || 0) + (((w = this.rectIns) == null ? void 0 : w.shape.x) || 0) - 1,
207
- y: ((v = this.rectIns) == null ? void 0 : v.shape.y) + 1,
207
+ y: ((v = this.rectIns) == null ? void 0 : v.shape.y) + 12,
208
208
  shape: {
209
209
  width: 2,
210
- height: t.offsetY - ((D = this.rectIns) == null ? void 0 : D.shape.y) - 2
210
+ height: t.offsetY - ((D = this.rectIns) == null ? void 0 : D.shape.y) - 24
211
211
  }
212
212
  }), this.circleList[6].attr({
213
- x: ((b = this.rectIns) == null ? void 0 : b.shape.x) + 1,
213
+ x: ((b = this.rectIns) == null ? void 0 : b.shape.x) + 12,
214
214
  y: t.offsetY - (((z = this.rectIns) == null ? void 0 : z.shape.y) || 0) + (((R = this.rectIns) == null ? void 0 : R.shape.y) || 0) - 1,
215
215
  shape: {
216
- width: t.offsetX - this.rectIns.shape.x - 2,
216
+ width: t.offsetX - this.rectIns.shape.x - 24,
217
217
  height: 2
218
218
  }
219
219
  }), this.circleList[7].attr({
220
220
  x: ((P = this.rectIns) == null ? void 0 : P.shape.x) - 1,
221
- y: ((M = this.rectIns) == null ? void 0 : M.shape.y) + 1,
221
+ y: ((M = this.rectIns) == null ? void 0 : M.shape.y) + 12,
222
222
  shape: {
223
223
  width: 2,
224
- height: t.offsetY - ((X = this.rectIns) == null ? void 0 : X.shape.y) - 2
224
+ height: t.offsetY - ((X = this.rectIns) == null ? void 0 : X.shape.y) - 24
225
225
  }
226
226
  }), this.calcText(), this.circleHideOrShow(!0), this.sceneRemoveEventListener();
227
227
  }
@@ -278,51 +278,51 @@ let o = class extends C {
278
278
  }), this.circleList[3].attr({
279
279
  x: t.target.x
280
280
  }), this.circleList[4].attr({
281
- x: t.target.x + 1,
281
+ x: t.target.x + 12,
282
282
  y: t.target.y - 1,
283
283
  shape: {
284
- width: i - 2
284
+ width: i - 24
285
285
  }
286
286
  }), this.circleList[7].attr({
287
287
  x: t.target.x - 1,
288
- y: t.target.y + 1,
288
+ y: t.target.y + 12,
289
289
  shape: {
290
- height: r - 2
290
+ height: r - 24
291
291
  }
292
292
  }), this.circleList[5].attr({
293
- y: t.target.y + 1,
293
+ y: t.target.y + 12,
294
294
  shape: {
295
- height: r - 2
295
+ height: r - 24
296
296
  }
297
297
  }), this.circleList[6].attr({
298
- x: t.target.x + 1,
298
+ x: t.target.x + 12,
299
299
  shape: {
300
- width: i - 2
300
+ width: i - 24
301
301
  }
302
302
  })) : e === 1 ? (a += h, i += s, h < 0 ? r += -h : r -= h, this.circleList[0].attr({
303
303
  y: t.target.y
304
304
  }), this.circleList[2].attr({
305
305
  x: t.target.x
306
306
  }), this.circleList[4].attr({
307
- x: t.target.x - i + 1,
307
+ x: t.target.x - i + 12,
308
308
  y: t.target.y - 1,
309
309
  shape: {
310
- width: i - 2
310
+ width: i - 24
311
311
  }
312
312
  }), this.circleList[5].attr({
313
313
  x: t.target.x - 1,
314
- y: t.target.y + 1,
314
+ y: t.target.y + 12,
315
315
  shape: {
316
- height: r - 2
316
+ height: r - 24
317
317
  }
318
318
  }), this.circleList[6].attr({
319
319
  shape: {
320
- width: i - 2
320
+ width: i - 24
321
321
  }
322
322
  }), this.circleList[7].attr({
323
- y: t.target.y + 1,
323
+ y: t.target.y + 12,
324
324
  shape: {
325
- height: r - 2
325
+ height: r - 24
326
326
  }
327
327
  })) : e === 2 ? (i += s, r += h, this.circleList[3].attr({
328
328
  y: t.target.y
@@ -331,105 +331,105 @@ let o = class extends C {
331
331
  }), this.circleList[5].attr({
332
332
  x: t.target.x - 1,
333
333
  shape: {
334
- height: r - 2
334
+ height: r - 24
335
335
  }
336
336
  }), this.circleList[6].attr({
337
337
  y: t.target.y - 1,
338
338
  shape: {
339
- width: i - 2
339
+ width: i - 24
340
340
  }
341
341
  }), this.circleList[4].attr({
342
342
  shape: {
343
- width: i - 2
343
+ width: i - 24
344
344
  }
345
345
  }), this.circleList[7].attr({
346
346
  shape: {
347
- height: r - 2
347
+ height: r - 24
348
348
  }
349
349
  })) : e === 3 ? (c += s, s < 0 ? i += -s : i -= s, r += h, this.circleList[2].attr({
350
350
  y: t.target.y
351
351
  }), this.circleList[0].attr({
352
352
  x: t.target.x
353
353
  }), this.circleList[6].attr({
354
- x: t.target.x + 1,
354
+ x: t.target.x + 12,
355
355
  y: t.target.y - 1,
356
356
  shape: {
357
- width: i - 2
357
+ width: i - 24
358
358
  }
359
359
  }), this.circleList[7].attr({
360
360
  x: t.target.x - 1,
361
361
  shape: {
362
- height: r - 2
362
+ height: r - 24
363
363
  }
364
364
  }), this.circleList[4].attr({
365
- x: t.target.x + 1,
365
+ x: t.target.x + 12,
366
366
  shape: {
367
- width: i - 2
367
+ width: i - 24
368
368
  }
369
369
  }), this.circleList[5].attr({
370
370
  shape: {
371
- height: r - 2
371
+ height: r - 24
372
372
  }
373
373
  })) : e === 4 ? (a += h, h < 0 ? r += -h : r -= h, this.circleList[0].attr({
374
374
  y: t.target.y + 1
375
375
  }), this.circleList[1].attr({
376
376
  y: t.target.y + 1
377
377
  }), this.circleList[5].attr({
378
- y: t.target.y + 2,
378
+ y: t.target.y + 12,
379
379
  shape: {
380
- height: r - 2
380
+ height: r - 24
381
381
  }
382
382
  }), this.circleList[7].attr({
383
- y: t.target.y + 2,
383
+ y: t.target.y + 12,
384
384
  shape: {
385
- height: r - 2
385
+ height: r - 24
386
386
  }
387
387
  }), this.circleList[4].attr({
388
- x: c + 1
388
+ x: c + 12
389
389
  })) : e === 5 ? (i += s, this.circleList[1].attr({
390
390
  x: t.target.x + 1
391
391
  }), this.circleList[2].attr({
392
392
  x: t.target.x + 1
393
393
  }), this.circleList[4].attr({
394
394
  shape: {
395
- width: i - 2
395
+ width: i - 24
396
396
  }
397
397
  }), this.circleList[6].attr({
398
398
  shape: {
399
- width: i - 2
399
+ width: i - 24
400
400
  }
401
401
  }), this.circleList[5].attr({
402
- y: a + 1
402
+ y: a + 12
403
403
  })) : e === 6 ? (r += h, this.circleList[2].attr({
404
404
  y: t.target.y + 1
405
405
  }), this.circleList[3].attr({
406
406
  y: t.target.y + 1
407
407
  }), this.circleList[5].attr({
408
408
  shape: {
409
- height: r - 2
409
+ height: r - 24
410
410
  }
411
411
  }), this.circleList[7].attr({
412
412
  shape: {
413
- height: r - 2
413
+ height: r - 24
414
414
  }
415
415
  }), this.circleList[6].attr({
416
- x: c + 1
416
+ x: c + 12
417
417
  })) : e === 7 && (c += s, s < 0 ? i += -s : i -= s, this.circleList[0].attr({
418
418
  x: t.target.x + 1
419
419
  }), this.circleList[3].attr({
420
420
  x: t.target.x + 1
421
421
  }), this.circleList[4].attr({
422
- x: t.target.x + 2,
422
+ x: t.target.x + 12,
423
423
  shape: {
424
- width: i - 2
424
+ width: i - 24
425
425
  }
426
426
  }), this.circleList[6].attr({
427
- x: t.target.x + 2,
427
+ x: t.target.x + 12,
428
428
  shape: {
429
- width: i - 2
429
+ width: i - 24
430
430
  }
431
431
  }), this.circleList[7].attr({
432
- y: a + 1
432
+ y: a + 12
433
433
  })), (n = this.rectIns) == null || n.attr({
434
434
  shape: {
435
435
  x: c,
@@ -243,32 +243,32 @@ let u = class extends E {
243
243
  x: (x = e.react) == null ? void 0 : x.shape.x,
244
244
  y: t.offsetY - (((m = e.react) == null ? void 0 : m.shape.y) || 0) + (((v = e.react) == null ? void 0 : v.shape.y) || 0)
245
245
  }), e.circleList[4].attr({
246
- x: ((w = e.react) == null ? void 0 : w.shape.x) + 1,
246
+ x: ((w = e.react) == null ? void 0 : w.shape.x) + 12,
247
247
  y: ((I = e.react) == null ? void 0 : I.shape.y) - 1,
248
248
  shape: {
249
- width: t.offsetX - e.react.shape.x - 2,
249
+ width: t.offsetX - e.react.shape.x - 24,
250
250
  height: 2
251
251
  }
252
252
  }), e.circleList[5].attr({
253
253
  x: t.offsetX - (((R = e.react) == null ? void 0 : R.shape.x) || 0) + (((D = e.react) == null ? void 0 : D.shape.x) || 0) - 1,
254
- y: ((b = e.react) == null ? void 0 : b.shape.y) + 1,
254
+ y: ((b = e.react) == null ? void 0 : b.shape.y) + 12,
255
255
  shape: {
256
256
  width: 2,
257
- height: t.offsetY - ((N = e.react) == null ? void 0 : N.shape.y) - 2
257
+ height: t.offsetY - ((N = e.react) == null ? void 0 : N.shape.y) - 24
258
258
  }
259
259
  }), e.circleList[6].attr({
260
- x: ((C = e.react) == null ? void 0 : C.shape.x) + 1,
260
+ x: ((C = e.react) == null ? void 0 : C.shape.x) + 12,
261
261
  y: t.offsetY - (((z = e.react) == null ? void 0 : z.shape.y) || 0) + (((M = e.react) == null ? void 0 : M.shape.y) || 0) - 1,
262
262
  shape: {
263
- width: t.offsetX - e.react.shape.x - 2,
263
+ width: t.offsetX - e.react.shape.x - 24,
264
264
  height: 2
265
265
  }
266
266
  }), e.circleList[7].attr({
267
267
  x: ((k = e.react) == null ? void 0 : k.shape.x) - 1,
268
- y: ((X = e.react) == null ? void 0 : X.shape.y) + 1,
268
+ y: ((X = e.react) == null ? void 0 : X.shape.y) + 12,
269
269
  shape: {
270
270
  width: 2,
271
- height: t.offsetY - ((Y = e.react) == null ? void 0 : Y.shape.y) - 2
271
+ height: t.offsetY - ((Y = e.react) == null ? void 0 : Y.shape.y) - 24
272
272
  }
273
273
  }), this.calcText(), this.circleHideOrShow(!0);
274
274
  break;
@@ -347,51 +347,51 @@ let u = class extends E {
347
347
  }), s.circleList[3].attr({
348
348
  x: t.target.x
349
349
  }), s.circleList[4].attr({
350
- x: t.target.x + 1,
350
+ x: t.target.x + 12,
351
351
  y: t.target.y - 1,
352
352
  shape: {
353
- width: a - 2
353
+ width: a - 24
354
354
  }
355
355
  }), s.circleList[7].attr({
356
356
  x: t.target.x - 1,
357
- y: t.target.y + 1,
357
+ y: t.target.y + 12,
358
358
  shape: {
359
- height: c - 2
359
+ height: c - 24
360
360
  }
361
361
  }), s.circleList[5].attr({
362
- y: t.target.y + 1,
362
+ y: t.target.y + 12,
363
363
  shape: {
364
- height: c - 2
364
+ height: c - 24
365
365
  }
366
366
  }), s.circleList[6].attr({
367
- x: t.target.x + 1,
367
+ x: t.target.x + 12,
368
368
  shape: {
369
- width: a - 2
369
+ width: a - 24
370
370
  }
371
371
  })) : e === 1 ? (f += i, a += r, i < 0 ? c += -i : c -= i, s.circleList[0].attr({
372
372
  y: t.target.y
373
373
  }), s.circleList[2].attr({
374
374
  x: t.target.x
375
375
  }), s.circleList[4].attr({
376
- x: t.target.x - a + 1,
376
+ x: t.target.x - a + 12,
377
377
  y: t.target.y - 1,
378
378
  shape: {
379
- width: a - 2
379
+ width: a - 24
380
380
  }
381
381
  }), s.circleList[5].attr({
382
382
  x: t.target.x - 1,
383
- y: t.target.y + 1,
383
+ y: t.target.y + 12,
384
384
  shape: {
385
- height: c - 2
385
+ height: c - 24
386
386
  }
387
387
  }), s.circleList[6].attr({
388
388
  shape: {
389
- width: a - 2
389
+ width: a - 24
390
390
  }
391
391
  }), s.circleList[7].attr({
392
- y: t.target.y + 1,
392
+ y: t.target.y + 12,
393
393
  shape: {
394
- height: c - 2
394
+ height: c - 24
395
395
  }
396
396
  })) : e === 2 ? (a += r, c += i, s.circleList[3].attr({
397
397
  y: t.target.y
@@ -400,105 +400,105 @@ let u = class extends E {
400
400
  }), s.circleList[5].attr({
401
401
  x: t.target.x - 1,
402
402
  shape: {
403
- height: c - 2
403
+ height: c - 24
404
404
  }
405
405
  }), s.circleList[6].attr({
406
406
  y: t.target.y - 1,
407
407
  shape: {
408
- width: a - 2
408
+ width: a - 24
409
409
  }
410
410
  }), s.circleList[4].attr({
411
411
  shape: {
412
- width: a - 2
412
+ width: a - 24
413
413
  }
414
414
  }), s.circleList[7].attr({
415
415
  shape: {
416
- height: c - 2
416
+ height: c - 24
417
417
  }
418
418
  })) : e === 3 ? (h += r, r < 0 ? a += -r : a -= r, c += i, s.circleList[2].attr({
419
419
  y: t.target.y
420
420
  }), s.circleList[0].attr({
421
421
  x: t.target.x
422
422
  }), s.circleList[6].attr({
423
- x: t.target.x + 1,
423
+ x: t.target.x + 12,
424
424
  y: t.target.y - 1,
425
425
  shape: {
426
- width: a - 2
426
+ width: a - 24
427
427
  }
428
428
  }), s.circleList[7].attr({
429
429
  x: t.target.x - 1,
430
430
  shape: {
431
- height: c - 2
431
+ height: c - 24
432
432
  }
433
433
  }), s.circleList[4].attr({
434
- x: t.target.x + 1,
434
+ x: t.target.x + 12,
435
435
  shape: {
436
- width: a - 2
436
+ width: a - 24
437
437
  }
438
438
  }), s.circleList[5].attr({
439
439
  shape: {
440
- height: c - 2
440
+ height: c - 24
441
441
  }
442
442
  })) : e === 4 ? (f += i, i < 0 ? c += -i : c -= i, s.circleList[0].attr({
443
443
  y: t.target.y + 1
444
444
  }), s.circleList[1].attr({
445
445
  y: t.target.y + 1
446
446
  }), s.circleList[5].attr({
447
- y: t.target.y + 2,
447
+ y: t.target.y + 12,
448
448
  shape: {
449
- height: c - 2
449
+ height: c - 24
450
450
  }
451
451
  }), s.circleList[7].attr({
452
- y: t.target.y + 2,
452
+ y: t.target.y + 12,
453
453
  shape: {
454
- height: c - 2
454
+ height: c - 24
455
455
  }
456
456
  }), s.circleList[4].attr({
457
- x: h + 1
457
+ x: h + 12
458
458
  })) : e === 5 ? (a += r, s.circleList[1].attr({
459
459
  x: t.target.x + 1
460
460
  }), s.circleList[2].attr({
461
461
  x: t.target.x + 1
462
462
  }), s.circleList[4].attr({
463
463
  shape: {
464
- width: a - 2
464
+ width: a - 24
465
465
  }
466
466
  }), s.circleList[6].attr({
467
467
  shape: {
468
- width: a - 2
468
+ width: a - 24
469
469
  }
470
470
  }), s.circleList[5].attr({
471
- y: f + 1
471
+ y: f + 12
472
472
  })) : e === 6 ? (c += i, s.circleList[2].attr({
473
473
  y: t.target.y + 1
474
474
  }), s.circleList[3].attr({
475
475
  y: t.target.y + 1
476
476
  }), s.circleList[5].attr({
477
477
  shape: {
478
- height: c - 2
478
+ height: c - 24
479
479
  }
480
480
  }), s.circleList[7].attr({
481
481
  shape: {
482
- height: c - 2
482
+ height: c - 24
483
483
  }
484
484
  }), s.circleList[6].attr({
485
- x: h + 1
485
+ x: h + 12
486
486
  })) : e === 7 && (h += r, r < 0 ? a += -r : a -= r, s.circleList[0].attr({
487
487
  x: t.target.x + 1
488
488
  }), s.circleList[3].attr({
489
489
  x: t.target.x + 1
490
490
  }), s.circleList[4].attr({
491
- x: t.target.x + 2,
491
+ x: t.target.x + 12,
492
492
  shape: {
493
- width: a - 2
493
+ width: a - 24
494
494
  }
495
495
  }), s.circleList[6].attr({
496
- x: t.target.x + 2,
496
+ x: t.target.x + 12,
497
497
  shape: {
498
- width: a - 2
498
+ width: a - 24
499
499
  }
500
500
  }), s.circleList[7].attr({
501
- y: f + 1
501
+ y: f + 12
502
502
  })), (n = s.react) == null || n.attr({
503
503
  shape: {
504
504
  x: h,
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./style/index.css");const C=require("vue"),j=require("../../node_modules/.pnpm/vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-class-component/dist/vue-class-component.esm.js");require("../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Emit.js");const l=require("../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Prop.js"),f=require("zrender"),d=require("@costy-plus/utils"),E=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},O=E(C);var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,n=(t,e,s,h)=>{for(var c=h>1?void 0:h?Y(e,s):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(c=(h?i(e,s,c):i(c))||c);return h&&c&&X(e,s,c),c};exports.default=class extends O.default{constructor(){super(...arguments),this.sceneIns=Object.freeze(null),this.measuringRulerGroup=Object.freeze(null),this.rectIns=Object.freeze(null),this.textIns=Object.freeze(null),this.fontFamily=Object.freeze("\u5FAE\u8F6F\u96C5\u9ED1"),this.circleList=Object.freeze([]),this.isMouseDown=Object.freeze(!1),this.originReactPostion=Object.freeze([]),this.circleDragPos=Object.freeze({x:0,y:0})}destroyed(){var t,e;(t=this.measuringRulerGroup)==null||t.removeAll(),(e=this.sceneIns)==null||e.dispose()}created(){this.initConfig()}initConfig(){this.circleList=[],this.circleDragPos={x:0,y:0},this.textIns=new f.Text({style:{lineHeight:this.config.textFontSize+4,fontSize:this.config.textFontSize,fill:this.config.textColor,fontFamily:this.fontFamily,fontWeight:"bold"}}),this.measuringRulerGroup=new f.Group({name:"measuringRuler"}),this.rectIns=new f.Rect({name:"rect",style:{stroke:this.config.stroke,lineWidth:this.config.lineW,fill:"transparent"},shape:{x:0,y:0},cursor:"move",draggable:!0});let t;const e=["nw-resize","ne-resize","se-resize","sw-resize","n-resize","e-resize","s-resize","w-resize"];for(let s=0;s<8;s++)s>3?t=new f.Rect({name:`${s}_circle`,style:{stroke:this.config.circleLinestroke,lineWidth:this.config.circleLineW,fill:"transparent"},shape:{width:1,height:1},cursor:e[s],zlevel:1,draggable:!0}):t=new f.Circle({name:`${s}_circle`,style:{stroke:this.config.circleLinestroke,lineWidth:this.config.circleLineW,fill:"transparent"},shape:{r:12},cursor:e[s],zlevel:1,draggable:!0}),t.hide(),this.measuringRulerGroup.add(t),this.circleList.push(t);this.measuringRulerGroup.add(new f.Rect({name:"main-box",style:{fill:"transparent"},shape:{x:0,y:0,width:this.width,height:this.height},cursor:"crosshair"})),this.measuringRulerGroup.add(this.rectIns),this.measuringRulerGroup.add(this.textIns)}mounted(){this.init()}init(){var e;const t=document.getElementById(`${this.prefixId}mx-measuring-ruler`);this.sceneIns=f.init(t,{width:this.width,height:this.height,devicePixelRatio:2}),(e=this.sceneIns)==null||e.add(this.measuringRulerGroup),this.sceneAddToEventListener(),this.rectAddToEventListener(),this.circleAddToEventListener()}calcText(){var h,c,a,i,r,o,u,p;const t=d.calcMs(((h=this.rectIns)==null?void 0:h.shape.width)||0,this.speedValue,this.cellMg,this.magnification),e=d.calcMV(((c=this.rectIns)==null?void 0:c.shape.height)||0,this.sens,this.magnification),s=t!==0&&d.calcBpm(t)||0;(p=this.textIns)==null||p.attr({style:{text:`${t} ms
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./style/index.css");const C=require("vue"),j=require("../../node_modules/.pnpm/vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-class-component/dist/vue-class-component.esm.js");require("../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Emit.js");const l=require("../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Prop.js"),p=require("zrender"),d=require("@costy-plus/utils"),E=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},O=E(C);var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,n=(t,e,s,h)=>{for(var c=h>1?void 0:h?Y(e,s):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(c=(h?i(e,s,c):i(c))||c);return h&&c&&X(e,s,c),c};exports.default=class extends O.default{constructor(){super(...arguments),this.sceneIns=Object.freeze(null),this.measuringRulerGroup=Object.freeze(null),this.rectIns=Object.freeze(null),this.textIns=Object.freeze(null),this.fontFamily=Object.freeze("\u5FAE\u8F6F\u96C5\u9ED1"),this.circleList=Object.freeze([]),this.isMouseDown=Object.freeze(!1),this.originReactPostion=Object.freeze([]),this.circleDragPos=Object.freeze({x:0,y:0})}destroyed(){var t,e;(t=this.measuringRulerGroup)==null||t.removeAll(),(e=this.sceneIns)==null||e.dispose()}created(){this.initConfig()}initConfig(){this.circleList=[],this.circleDragPos={x:0,y:0},this.textIns=new p.Text({style:{lineHeight:this.config.textFontSize+4,fontSize:this.config.textFontSize,fill:this.config.textColor,fontFamily:this.fontFamily,fontWeight:"bold"}}),this.measuringRulerGroup=new p.Group({name:"measuringRuler"}),this.rectIns=new p.Rect({name:"rect",style:{stroke:this.config.stroke,lineWidth:this.config.lineW,fill:"transparent"},shape:{x:0,y:0},cursor:"move",draggable:!0});let t;const e=["nw-resize","ne-resize","se-resize","sw-resize","n-resize","e-resize","s-resize","w-resize"];for(let s=0;s<8;s++)s>3?t=new p.Rect({name:`${s}_circle`,style:{stroke:this.config.circleLinestroke,lineWidth:this.config.circleLineW,fill:"red"},shape:{width:1,height:1},cursor:e[s],zlevel:1,draggable:!0}):t=new p.Circle({name:`${s}_circle`,style:{stroke:this.config.circleLinestroke,lineWidth:this.config.circleLineW,fill:"black"},shape:{r:12},cursor:e[s],zlevel:1,draggable:!0}),t.hide(),this.measuringRulerGroup.add(t),this.circleList.push(t);this.measuringRulerGroup.add(new p.Rect({name:"main-box",style:{fill:"transparent"},shape:{x:0,y:0,width:this.width,height:this.height},cursor:"crosshair"})),this.measuringRulerGroup.add(this.rectIns),this.measuringRulerGroup.add(this.textIns)}mounted(){this.init()}init(){var e;const t=document.getElementById(`${this.prefixId}mx-measuring-ruler`);this.sceneIns=p.init(t,{width:this.width,height:this.height,devicePixelRatio:2}),(e=this.sceneIns)==null||e.add(this.measuringRulerGroup),this.sceneAddToEventListener(),this.rectAddToEventListener(),this.circleAddToEventListener()}calcText(){var h,c,a,i,r,o,u,f;const t=d.calcMs(((h=this.rectIns)==null?void 0:h.shape.width)||0,this.speedValue,this.cellMg,this.magnification),e=d.calcMV(((c=this.rectIns)==null?void 0:c.shape.height)||0,this.sens,this.magnification),s=t!==0&&d.calcBpm(t)||0;(f=this.textIns)==null||f.attr({style:{text:`${t} ms
2
2
  ${s} bpm
3
- ${e} mV`,x:(((a=this.rectIns)==null?void 0:a.x)||0)+(((i=this.rectIns)==null?void 0:i.shape.x)||0)+(((r=this.rectIns)==null?void 0:r.shape.width)||0)+20,y:(((o=this.rectIns)==null?void 0:o.y)||0)+(((u=this.rectIns)==null?void 0:u.shape.y)||0)}})}circleHideOrShow(t){this.circleList.forEach(e=>t?e.show():e.hide())}sceneAddToEventListener(){var s,h,c,a,i;const t=r=>{r.event.preventDefault(),this.$emit("notifyMeasuringRuler",{name:"contextmenu"})},e=r=>{this.$emit("notifyMeasuringRuler",{name:"dblclick"})};(s=this.sceneIns)==null||s.on("contextmenu",t),(h=this.sceneIns)==null||h.on("mousedown",this.sceneMousedown),(c=this.sceneIns)==null||c.on("mousemove",this.scenemousemove),(a=this.sceneIns)==null||a.on("mouseup",this.scenemouseup),(i=this.sceneIns)==null||i.on("dblclick",e),this.$once("hook:beforeDestroy",()=>{var r,o,u,p,g;(r=this.sceneIns)==null||r.off("contextmenu",t),(o=this.sceneIns)==null||o.off("mousedown",this.sceneMousedown),(u=this.sceneIns)==null||u.off("mousemove",this.scenemousemove),(p=this.sceneIns)==null||p.off("mouseup",this.scenemouseup),(g=this.sceneIns)==null||g.off("dblclick",e)})}sceneRemoveEventListener(){var t,e,s;(t=this.sceneIns)==null||t.off("mousedown",this.sceneMousedown),(e=this.sceneIns)==null||e.off("mousemove",this.scenemousemove),(s=this.sceneIns)==null||s.off("mouseup",this.scenemouseup)}sceneMousedown(t){var e;this.isMouseDown=!0,(e=this.rectIns)==null||e.attr({shape:{x:t.offsetX,y:t.offsetY}})}scenemousemove(t){var e;!this.isMouseDown||(e=this.rectIns)==null||e.attr({shape:{width:t.offsetX-this.rectIns.shape.x,height:t.offsetY-this.rectIns.shape.y}})}scenemouseup(t){var e,s,h,c,a,i,r,o,u,p,g,y,x,m,I,L,w,v,b,D,P,_,z,R,M;this.isMouseDown=!1,(e=this.rectIns)==null||e.attr({shape:{width:t.offsetX-this.rectIns.shape.x,height:t.offsetY-this.rectIns.shape.y}}),this.circleList[0].attr({x:(s=this.rectIns)==null?void 0:s.shape.x,y:(h=this.rectIns)==null?void 0:h.shape.y}),this.circleList[1].attr({x:t.offsetX-(((c=this.rectIns)==null?void 0:c.shape.x)||0)+(((a=this.rectIns)==null?void 0:a.shape.x)||0),y:(i=this.rectIns)==null?void 0:i.shape.y}),this.circleList[2].attr({x:t.offsetX-(((r=this.rectIns)==null?void 0:r.shape.x)||0)+(((o=this.rectIns)==null?void 0:o.shape.x)||0),y:t.offsetY-(((u=this.rectIns)==null?void 0:u.shape.y)||0)+(((p=this.rectIns)==null?void 0:p.shape.y)||0)}),this.circleList[3].attr({x:(g=this.rectIns)==null?void 0:g.shape.x,y:t.offsetY-(((y=this.rectIns)==null?void 0:y.shape.y)||0)+(((x=this.rectIns)==null?void 0:x.shape.y)||0)}),this.circleList[4].attr({x:((m=this.rectIns)==null?void 0:m.shape.x)+1,y:((I=this.rectIns)==null?void 0:I.shape.y)-1,shape:{width:t.offsetX-this.rectIns.shape.x-2,height:2}}),this.circleList[5].attr({x:t.offsetX-(((L=this.rectIns)==null?void 0:L.shape.x)||0)+(((w=this.rectIns)==null?void 0:w.shape.x)||0)-1,y:((v=this.rectIns)==null?void 0:v.shape.y)+1,shape:{width:2,height:t.offsetY-((b=this.rectIns)==null?void 0:b.shape.y)-2}}),this.circleList[6].attr({x:((D=this.rectIns)==null?void 0:D.shape.x)+1,y:t.offsetY-(((P=this.rectIns)==null?void 0:P.shape.y)||0)+(((_=this.rectIns)==null?void 0:_.shape.y)||0)-1,shape:{width:t.offsetX-this.rectIns.shape.x-2,height:2}}),this.circleList[7].attr({x:((z=this.rectIns)==null?void 0:z.shape.x)-1,y:((R=this.rectIns)==null?void 0:R.shape.y)+1,shape:{width:2,height:t.offsetY-((M=this.rectIns)==null?void 0:M.shape.y)-2}}),this.calcText(),this.circleHideOrShow(!0),this.sceneRemoveEventListener()}rectAddToEventListener(){var t;(t=this.rectIns)==null||t.on("drag",this.rectDrag),this.$once("hook:beforeDestroy",()=>{var e;(e=this.rectIns)==null||e.on("drag",this.rectDrag)})}rectDrag(t){var e;if(t.offsetX<=5||t.offsetX>=this.width-5||t.offsetY<=5||t.offsetY>=this.height-5){(e=this.rectIns)==null||e.setPosition([this.originReactPostion[0],this.originReactPostion[1]]);return}this.originReactPostion=[t.target.x,t.target.y],this.circleList.forEach((s,h)=>{h>3?s.attr({shape:{x:t.target.x,y:t.target.y}}):s.attr({shape:{cx:t.target.x,cy:t.target.y}})}),this.calcText(),console.log("rectDrag--\u8FD9\u91CC")}circleAddToEventListener(){this.circleList.forEach(t=>{t.on("drag",this.circleDrag),t.on("dragstart",this.circleDragStart)}),this.$once("hook:beforeDestroy",()=>{this.circleList.forEach(t=>{t.off("drag",this.circleDrag),t.off("dragstart",this.circleDragStart)})})}circleDragStart(t){console.log("circleDragStart--\u8FD9\u91CC",t),this.circleDragPos.x=t.offsetX,this.circleDragPos.y=t.offsetY}circleDrag(t){var o;console.log("circleDrag--\u8FD9\u91CC",t);const e=parseInt(t.target.name);if(isNaN(e))return;const s=t.offsetX-this.circleDragPos.x,h=t.offsetY-this.circleDragPos.y;this.circleDragPos.x=t.offsetX,this.circleDragPos.y=t.offsetY;let c=this.rectIns.shape.x,a=this.rectIns.shape.y,i=this.rectIns.shape.width,r=this.rectIns.shape.height;console.log("moveX",s,h),e===0?(c+=s,a+=h,s<0?i+=-s:i-=s,h<0?r+=-h:r-=h,this.circleList[1].attr({y:t.target.y}),this.circleList[3].attr({x:t.target.x}),this.circleList[4].attr({x:t.target.x+1,y:t.target.y-1,shape:{width:i-2}}),this.circleList[7].attr({x:t.target.x-1,y:t.target.y+1,shape:{height:r-2}}),this.circleList[5].attr({y:t.target.y+1,shape:{height:r-2}}),this.circleList[6].attr({x:t.target.x+1,shape:{width:i-2}})):e===1?(a+=h,i+=s,h<0?r+=-h:r-=h,this.circleList[0].attr({y:t.target.y}),this.circleList[2].attr({x:t.target.x}),this.circleList[4].attr({x:t.target.x-i+1,y:t.target.y-1,shape:{width:i-2}}),this.circleList[5].attr({x:t.target.x-1,y:t.target.y+1,shape:{height:r-2}}),this.circleList[6].attr({shape:{width:i-2}}),this.circleList[7].attr({y:t.target.y+1,shape:{height:r-2}})):e===2?(i+=s,r+=h,this.circleList[3].attr({y:t.target.y}),this.circleList[1].attr({x:t.target.x}),this.circleList[5].attr({x:t.target.x-1,shape:{height:r-2}}),this.circleList[6].attr({y:t.target.y-1,shape:{width:i-2}}),this.circleList[4].attr({shape:{width:i-2}}),this.circleList[7].attr({shape:{height:r-2}})):e===3?(c+=s,s<0?i+=-s:i-=s,r+=h,this.circleList[2].attr({y:t.target.y}),this.circleList[0].attr({x:t.target.x}),this.circleList[6].attr({x:t.target.x+1,y:t.target.y-1,shape:{width:i-2}}),this.circleList[7].attr({x:t.target.x-1,shape:{height:r-2}}),this.circleList[4].attr({x:t.target.x+1,shape:{width:i-2}}),this.circleList[5].attr({shape:{height:r-2}})):e===4?(a+=h,h<0?r+=-h:r-=h,this.circleList[0].attr({y:t.target.y+1}),this.circleList[1].attr({y:t.target.y+1}),this.circleList[5].attr({y:t.target.y+2,shape:{height:r-2}}),this.circleList[7].attr({y:t.target.y+2,shape:{height:r-2}}),this.circleList[4].attr({x:c+1})):e===5?(i+=s,this.circleList[1].attr({x:t.target.x+1}),this.circleList[2].attr({x:t.target.x+1}),this.circleList[4].attr({shape:{width:i-2}}),this.circleList[6].attr({shape:{width:i-2}}),this.circleList[5].attr({y:a+1})):e===6?(r+=h,this.circleList[2].attr({y:t.target.y+1}),this.circleList[3].attr({y:t.target.y+1}),this.circleList[5].attr({shape:{height:r-2}}),this.circleList[7].attr({shape:{height:r-2}}),this.circleList[6].attr({x:c+1})):e===7&&(c+=s,s<0?i+=-s:i-=s,this.circleList[0].attr({x:t.target.x+1}),this.circleList[3].attr({x:t.target.x+1}),this.circleList[4].attr({x:t.target.x+2,shape:{width:i-2}}),this.circleList[6].attr({x:t.target.x+2,shape:{width:i-2}}),this.circleList[7].attr({y:a+1})),(o=this.rectIns)==null||o.attr({shape:{x:c,y:a,width:i,height:r}}),this.calcText()}};n([l.Prop({default:()=>""})],exports.default.prototype,"prefixId",2);n([l.Prop({required:!0,type:Number,validator:t=>typeof t=="number"})],exports.default.prototype,"width",2);n([l.Prop({required:!0,type:Number,validator:t=>typeof t=="number"})],exports.default.prototype,"height",2);n([l.Prop({default:()=>({lineW:1,stroke:"#00C800",circleLineW:1,circleLinestroke:"blue",textColor:"#000",textFontSize:12})})],exports.default.prototype,"config",2);n([l.Prop({required:!0})],exports.default.prototype,"speedValue",2);n([l.Prop({required:!0})],exports.default.prototype,"cellMg",2);n([l.Prop({default:1})],exports.default.prototype,"magnification",2);n([l.Prop({default:1})],exports.default.prototype,"sens",2);n([l.Prop({default:()=>""})],exports.default.prototype,"className",2);exports.default=n([j.default({name:"MXMeasuringRuler"})],exports.default);
3
+ ${e} mV`,x:(((a=this.rectIns)==null?void 0:a.x)||0)+(((i=this.rectIns)==null?void 0:i.shape.x)||0)+(((r=this.rectIns)==null?void 0:r.shape.width)||0)+20,y:(((o=this.rectIns)==null?void 0:o.y)||0)+(((u=this.rectIns)==null?void 0:u.shape.y)||0)}})}circleHideOrShow(t){this.circleList.forEach(e=>t?e.show():e.hide())}sceneAddToEventListener(){var s,h,c,a,i;const t=r=>{r.event.preventDefault(),this.$emit("notifyMeasuringRuler",{name:"contextmenu"})},e=r=>{this.$emit("notifyMeasuringRuler",{name:"dblclick"})};(s=this.sceneIns)==null||s.on("contextmenu",t),(h=this.sceneIns)==null||h.on("mousedown",this.sceneMousedown),(c=this.sceneIns)==null||c.on("mousemove",this.scenemousemove),(a=this.sceneIns)==null||a.on("mouseup",this.scenemouseup),(i=this.sceneIns)==null||i.on("dblclick",e),this.$once("hook:beforeDestroy",()=>{var r,o,u,f,g;(r=this.sceneIns)==null||r.off("contextmenu",t),(o=this.sceneIns)==null||o.off("mousedown",this.sceneMousedown),(u=this.sceneIns)==null||u.off("mousemove",this.scenemousemove),(f=this.sceneIns)==null||f.off("mouseup",this.scenemouseup),(g=this.sceneIns)==null||g.off("dblclick",e)})}sceneRemoveEventListener(){var t,e,s;(t=this.sceneIns)==null||t.off("mousedown",this.sceneMousedown),(e=this.sceneIns)==null||e.off("mousemove",this.scenemousemove),(s=this.sceneIns)==null||s.off("mouseup",this.scenemouseup)}sceneMousedown(t){var e;this.isMouseDown=!0,(e=this.rectIns)==null||e.attr({shape:{x:t.offsetX,y:t.offsetY}})}scenemousemove(t){var e;!this.isMouseDown||(e=this.rectIns)==null||e.attr({shape:{width:t.offsetX-this.rectIns.shape.x,height:t.offsetY-this.rectIns.shape.y}})}scenemouseup(t){var e,s,h,c,a,i,r,o,u,f,g,y,x,m,I,L,w,v,b,D,P,_,z,R,M;this.isMouseDown=!1,(e=this.rectIns)==null||e.attr({shape:{width:t.offsetX-this.rectIns.shape.x,height:t.offsetY-this.rectIns.shape.y}}),this.circleList[0].attr({x:(s=this.rectIns)==null?void 0:s.shape.x,y:(h=this.rectIns)==null?void 0:h.shape.y}),this.circleList[1].attr({x:t.offsetX-(((c=this.rectIns)==null?void 0:c.shape.x)||0)+(((a=this.rectIns)==null?void 0:a.shape.x)||0),y:(i=this.rectIns)==null?void 0:i.shape.y}),this.circleList[2].attr({x:t.offsetX-(((r=this.rectIns)==null?void 0:r.shape.x)||0)+(((o=this.rectIns)==null?void 0:o.shape.x)||0),y:t.offsetY-(((u=this.rectIns)==null?void 0:u.shape.y)||0)+(((f=this.rectIns)==null?void 0:f.shape.y)||0)}),this.circleList[3].attr({x:(g=this.rectIns)==null?void 0:g.shape.x,y:t.offsetY-(((y=this.rectIns)==null?void 0:y.shape.y)||0)+(((x=this.rectIns)==null?void 0:x.shape.y)||0)}),this.circleList[4].attr({x:((m=this.rectIns)==null?void 0:m.shape.x)+12,y:((I=this.rectIns)==null?void 0:I.shape.y)-1,shape:{width:t.offsetX-this.rectIns.shape.x-24,height:2}}),this.circleList[5].attr({x:t.offsetX-(((L=this.rectIns)==null?void 0:L.shape.x)||0)+(((w=this.rectIns)==null?void 0:w.shape.x)||0)-1,y:((v=this.rectIns)==null?void 0:v.shape.y)+12,shape:{width:2,height:t.offsetY-((b=this.rectIns)==null?void 0:b.shape.y)-24}}),this.circleList[6].attr({x:((D=this.rectIns)==null?void 0:D.shape.x)+12,y:t.offsetY-(((P=this.rectIns)==null?void 0:P.shape.y)||0)+(((_=this.rectIns)==null?void 0:_.shape.y)||0)-1,shape:{width:t.offsetX-this.rectIns.shape.x-24,height:2}}),this.circleList[7].attr({x:((z=this.rectIns)==null?void 0:z.shape.x)-1,y:((R=this.rectIns)==null?void 0:R.shape.y)+12,shape:{width:2,height:t.offsetY-((M=this.rectIns)==null?void 0:M.shape.y)-24}}),this.calcText(),this.circleHideOrShow(!0),this.sceneRemoveEventListener()}rectAddToEventListener(){var t;(t=this.rectIns)==null||t.on("drag",this.rectDrag),this.$once("hook:beforeDestroy",()=>{var e;(e=this.rectIns)==null||e.on("drag",this.rectDrag)})}rectDrag(t){var e;if(t.offsetX<=5||t.offsetX>=this.width-5||t.offsetY<=5||t.offsetY>=this.height-5){(e=this.rectIns)==null||e.setPosition([this.originReactPostion[0],this.originReactPostion[1]]);return}this.originReactPostion=[t.target.x,t.target.y],this.circleList.forEach((s,h)=>{h>3?s.attr({shape:{x:t.target.x,y:t.target.y}}):s.attr({shape:{cx:t.target.x,cy:t.target.y}})}),this.calcText(),console.log("rectDrag--\u8FD9\u91CC")}circleAddToEventListener(){this.circleList.forEach(t=>{t.on("drag",this.circleDrag),t.on("dragstart",this.circleDragStart)}),this.$once("hook:beforeDestroy",()=>{this.circleList.forEach(t=>{t.off("drag",this.circleDrag),t.off("dragstart",this.circleDragStart)})})}circleDragStart(t){console.log("circleDragStart--\u8FD9\u91CC",t),this.circleDragPos.x=t.offsetX,this.circleDragPos.y=t.offsetY}circleDrag(t){var o;console.log("circleDrag--\u8FD9\u91CC",t);const e=parseInt(t.target.name);if(isNaN(e))return;const s=t.offsetX-this.circleDragPos.x,h=t.offsetY-this.circleDragPos.y;this.circleDragPos.x=t.offsetX,this.circleDragPos.y=t.offsetY;let c=this.rectIns.shape.x,a=this.rectIns.shape.y,i=this.rectIns.shape.width,r=this.rectIns.shape.height;console.log("moveX",s,h),e===0?(c+=s,a+=h,s<0?i+=-s:i-=s,h<0?r+=-h:r-=h,this.circleList[1].attr({y:t.target.y}),this.circleList[3].attr({x:t.target.x}),this.circleList[4].attr({x:t.target.x+12,y:t.target.y-1,shape:{width:i-24}}),this.circleList[7].attr({x:t.target.x-1,y:t.target.y+12,shape:{height:r-24}}),this.circleList[5].attr({y:t.target.y+12,shape:{height:r-24}}),this.circleList[6].attr({x:t.target.x+12,shape:{width:i-24}})):e===1?(a+=h,i+=s,h<0?r+=-h:r-=h,this.circleList[0].attr({y:t.target.y}),this.circleList[2].attr({x:t.target.x}),this.circleList[4].attr({x:t.target.x-i+12,y:t.target.y-1,shape:{width:i-24}}),this.circleList[5].attr({x:t.target.x-1,y:t.target.y+12,shape:{height:r-24}}),this.circleList[6].attr({shape:{width:i-24}}),this.circleList[7].attr({y:t.target.y+12,shape:{height:r-24}})):e===2?(i+=s,r+=h,this.circleList[3].attr({y:t.target.y}),this.circleList[1].attr({x:t.target.x}),this.circleList[5].attr({x:t.target.x-1,shape:{height:r-24}}),this.circleList[6].attr({y:t.target.y-1,shape:{width:i-24}}),this.circleList[4].attr({shape:{width:i-24}}),this.circleList[7].attr({shape:{height:r-24}})):e===3?(c+=s,s<0?i+=-s:i-=s,r+=h,this.circleList[2].attr({y:t.target.y}),this.circleList[0].attr({x:t.target.x}),this.circleList[6].attr({x:t.target.x+12,y:t.target.y-1,shape:{width:i-24}}),this.circleList[7].attr({x:t.target.x-1,shape:{height:r-24}}),this.circleList[4].attr({x:t.target.x+12,shape:{width:i-24}}),this.circleList[5].attr({shape:{height:r-24}})):e===4?(a+=h,h<0?r+=-h:r-=h,this.circleList[0].attr({y:t.target.y+1}),this.circleList[1].attr({y:t.target.y+1}),this.circleList[5].attr({y:t.target.y+12,shape:{height:r-24}}),this.circleList[7].attr({y:t.target.y+12,shape:{height:r-24}}),this.circleList[4].attr({x:c+12})):e===5?(i+=s,this.circleList[1].attr({x:t.target.x+1}),this.circleList[2].attr({x:t.target.x+1}),this.circleList[4].attr({shape:{width:i-24}}),this.circleList[6].attr({shape:{width:i-24}}),this.circleList[5].attr({y:a+12})):e===6?(r+=h,this.circleList[2].attr({y:t.target.y+1}),this.circleList[3].attr({y:t.target.y+1}),this.circleList[5].attr({shape:{height:r-24}}),this.circleList[7].attr({shape:{height:r-24}}),this.circleList[6].attr({x:c+12})):e===7&&(c+=s,s<0?i+=-s:i-=s,this.circleList[0].attr({x:t.target.x+1}),this.circleList[3].attr({x:t.target.x+1}),this.circleList[4].attr({x:t.target.x+12,shape:{width:i-24}}),this.circleList[6].attr({x:t.target.x+12,shape:{width:i-24}}),this.circleList[7].attr({y:a+12})),(o=this.rectIns)==null||o.attr({shape:{x:c,y:a,width:i,height:r}}),this.calcText()}};n([l.Prop({default:()=>""})],exports.default.prototype,"prefixId",2);n([l.Prop({required:!0,type:Number,validator:t=>typeof t=="number"})],exports.default.prototype,"width",2);n([l.Prop({required:!0,type:Number,validator:t=>typeof t=="number"})],exports.default.prototype,"height",2);n([l.Prop({default:()=>({lineW:1,stroke:"#00C800",circleLineW:1,circleLinestroke:"blue",textColor:"#000",textFontSize:12})})],exports.default.prototype,"config",2);n([l.Prop({required:!0})],exports.default.prototype,"speedValue",2);n([l.Prop({required:!0})],exports.default.prototype,"cellMg",2);n([l.Prop({default:1})],exports.default.prototype,"magnification",2);n([l.Prop({default:1})],exports.default.prototype,"sens",2);n([l.Prop({default:()=>""})],exports.default.prototype,"className",2);exports.default=n([j.default({name:"MXMeasuringRuler"})],exports.default);
@@ -1,3 +1,3 @@
1
1
  "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./style/index.css");const X=require("vue"),E=require("../../node_modules/.pnpm/vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-class-component/dist/vue-class-component.esm.js");require("../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Emit.js");const p=require("../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Prop.js"),g=require("zrender"),L=require("@costy-plus/utils"),Y=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},j=Y(X);var G=Object.defineProperty,O=Object.getOwnPropertyDescriptor,f=(e,t,s,r)=>{for(var i=r>1?void 0:r?O(t,s):t,h=e.length-1,n;h>=0;h--)(n=e[h])&&(i=(r?n(t,s,i):n(i))||i);return r&&i&&G(t,s,i),i};exports.default=class extends j.default{constructor(){super(...arguments),this.sceneIns=Object.freeze(null),this.measuringRulerGroup=Object.freeze(null),this.rectInsList=Object.freeze([]),this.fontFamily=Object.freeze("\u5FAE\u8F6F\u96C5\u9ED1"),this.isMouseDown=Object.freeze(!1),this.moveReactName=Object.freeze("")}destroyed(){var e,t;(e=this.measuringRulerGroup)==null||e.removeAll(),(t=this.sceneIns)==null||t.dispose()}created(){this.rectInsList=[],this.measuringRulerGroup=new g.Group({name:"measuringRuler"}),this.initConfig()}clearCanvas(){var e,t;this.rectInsList=[],(e=this.measuringRulerGroup)==null||e.removeAll(),(t=this.sceneIns)==null||t.remove(this.measuringRulerGroup)}initConfig(){var e;(e=this.measuringRulerGroup)==null||e.add(new g.Rect({name:"main-box",style:{fill:"transparent"},shape:{x:0,y:0,width:this.width,height:this.height},cursor:"crosshair"}))}mounted(){this.init()}init(){var t;const e=document.getElementById(`${this.prefixId}mx-measuring-ruler`);this.sceneIns=g.init(e,{width:this.width,height:this.height,devicePixelRatio:2}),(t=this.sceneIns)==null||t.add(this.measuringRulerGroup),this.sceneAddToEventListener(),this.rectAddToEventListener(),this.circleAddToEventListener()}calcText(){var i,h,n,l,o,u,a,c,m,x;let e,t=0,s="",r=0;for(let d=0;d<this.rectInsList.length;d++)if(e=this.rectInsList[d],((i=e.react)==null?void 0:i.name)===this.moveReactName&&((h=e.react)==null?void 0:h.shape.width)){t=L.calcMs(((n=e.react)==null?void 0:n.shape.width)||0,this.speedValue,this.cellMg,this.magnification),s=L.calcMV(((l=e.react)==null?void 0:l.shape.height)||0,this.sens,this.magnification),r=t!==0&&L.calcBpm(t)||0,(x=e.text)==null||x.attr({style:{text:`${t} ms
2
2
  ${r} bpm
3
- ${s} mV`,x:(((o=e.react)==null?void 0:o.x)||0)+(((u=e.react)==null?void 0:u.shape.x)||0)+(((a=e.react)==null?void 0:a.shape.width)||0)+20,y:(((c=e.react)==null?void 0:c.y)||0)+(((m=e.react)==null?void 0:m.shape.y)||0)}});break}e=null}circleHideOrShow(e){var s;let t;for(let r=0;r<this.rectInsList.length;r++)if(t=this.rectInsList[r],((s=t.react)==null?void 0:s.name)===this.moveReactName){t.circleList.forEach(i=>e?i.show():i.hide());break}t=null}sceneAddToEventListener(){var s,r,i,h,n;const e=l=>{var o;l.event.preventDefault(),this.clearCanvas(),this.initConfig(),(o=this.sceneIns)==null||o.add(this.measuringRulerGroup),this.$emit("notifyMeasuringRuler",{name:"contextmenu"})},t=l=>{var o;this.clearCanvas(),this.initConfig(),(o=this.sceneIns)==null||o.add(this.measuringRulerGroup),this.$emit("notifyMeasuringRuler",{name:"dblclick"})};(s=this.sceneIns)==null||s.on("contextmenu",e),(r=this.sceneIns)==null||r.on("mousedown",this.sceneMousedown),(i=this.sceneIns)==null||i.on("mousemove",this.scenemousemove),(h=this.sceneIns)==null||h.on("mouseup",this.scenemouseup),(n=this.sceneIns)==null||n.on("dblclick",t),this.$once("hook:beforeDestroy",()=>{var l,o,u,a,c;(l=this.sceneIns)==null||l.off("contextmenu",e),(o=this.sceneIns)==null||o.off("mousedown",this.sceneMousedown),(u=this.sceneIns)==null||u.off("mousemove",this.scenemousemove),(a=this.sceneIns)==null||a.off("mouseup",this.scenemouseup),(c=this.sceneIns)==null||c.off("dblclick",t)})}sceneRemoveEventListener(){var e,t,s;(e=this.sceneIns)==null||e.off("mousedown",this.sceneMousedown),(t=this.sceneIns)==null||t.off("mousemove",this.scenemousemove),(s=this.sceneIns)==null||s.off("mouseup",this.scenemouseup)}createRectBox(e,t,s){this.moveReactName=e;const r=new g.Rect({name:e,style:{stroke:this.config.stroke,lineWidth:this.config.lineW,fill:"transparent"},shape:{x:t,y:s},ondrag:this.rectDrag,cursor:"move",draggable:!0}),i=new g.Text({style:{lineHeight:this.config.textFontSize+4,fontSize:this.config.textFontSize,fill:this.config.textColor,fontFamily:this.fontFamily,fontWeight:"bold"}}),h=[];let n;const l=["nw-resize","ne-resize","se-resize","sw-resize","n-resize","e-resize","s-resize","w-resize"];for(let o=0;o<8;o++)o>3?n=new g.Rect({name:`${o}_circle`,customName:e,style:{stroke:this.config.circleLinestroke,lineWidth:this.config.circleLineW,fill:"transparent"},shape:{width:1,height:1},cursor:l[o],zlevel:1,draggable:!0,ondrag:this.circleDrag,ondragstart:this.circleDragStart}):n=new g.Circle({name:`${o}_circle`,customName:e,style:{stroke:this.config.circleLinestroke,lineWidth:this.config.circleLineW,fill:"transparent"},shape:{r:12},cursor:l[o],zlevel:1,draggable:!0,ondrag:this.circleDrag,ondragstart:this.circleDragStart}),n.hide(),this.measuringRulerGroup.add(n),h.push(n);return this.measuringRulerGroup.add(i),this.measuringRulerGroup.add(r),{react:r,text:i,circleList:h,circleDragPos:{x:0,y:0}}}sceneMousedown(e){var t;if(console.log("sceneMousedown",e),e.event.button===0)if(this.isMouseDown=!0,this.rectInsList.length===0)this.rectInsList.push(this.createRectBox("react_1",e.offsetX,e.offsetY));else{let s=!1,r;for(let i=0;i<this.rectInsList.length&&(r=this.rectInsList[i],s=((t=r.react)==null?void 0:t.contain(e.offsetX,e.offsetY))||!1,!s);i++);r=null,s||this.rectInsList.push(this.createRectBox(`react_${this.rectInsList.length+1}`,e.offsetX,e.offsetY)),console.log("isContain",s)}}scenemousemove(e){var s,r;if(!this.isMouseDown)return;let t;for(let i=0;i<this.rectInsList.length;i++)if(t=this.rectInsList[i],((s=t.react)==null?void 0:s.name)===this.moveReactName){(r=t.react)==null||r.attr({shape:{width:e.offsetX-t.react.shape.x,height:e.offsetY-t.react.shape.y}});break}t=null}scenemouseup(e){var s,r,i,h,n,l,o,u,a,c,m,x,d,v,w,I,R,b,D,_,N,C,P,z,M,k;this.isMouseDown=!1;let t;for(let y=0;y<this.rectInsList.length;y++)if(t=this.rectInsList[y],((s=t.react)==null?void 0:s.name)===this.moveReactName){(r=t.react)==null||r.attr({shape:{width:e.offsetX-t.react.shape.x,height:e.offsetY-t.react.shape.y}}),t.circleList[0].attr({x:(i=t.react)==null?void 0:i.shape.x,y:(h=t.react)==null?void 0:h.shape.y}),t.circleList[1].attr({x:e.offsetX-(((n=t.react)==null?void 0:n.shape.x)||0)+(((l=t.react)==null?void 0:l.shape.x)||0),y:(o=t.react)==null?void 0:o.shape.y}),t.circleList[2].attr({x:e.offsetX-(((u=t.react)==null?void 0:u.shape.x)||0)+(((a=t.react)==null?void 0:a.shape.x)||0),y:e.offsetY-(((c=t.react)==null?void 0:c.shape.y)||0)+(((m=t.react)==null?void 0:m.shape.y)||0)}),t.circleList[3].attr({x:(x=t.react)==null?void 0:x.shape.x,y:e.offsetY-(((d=t.react)==null?void 0:d.shape.y)||0)+(((v=t.react)==null?void 0:v.shape.y)||0)}),t.circleList[4].attr({x:((w=t.react)==null?void 0:w.shape.x)+1,y:((I=t.react)==null?void 0:I.shape.y)-1,shape:{width:e.offsetX-t.react.shape.x-2,height:2}}),t.circleList[5].attr({x:e.offsetX-(((R=t.react)==null?void 0:R.shape.x)||0)+(((b=t.react)==null?void 0:b.shape.x)||0)-1,y:((D=t.react)==null?void 0:D.shape.y)+1,shape:{width:2,height:e.offsetY-((_=t.react)==null?void 0:_.shape.y)-2}}),t.circleList[6].attr({x:((N=t.react)==null?void 0:N.shape.x)+1,y:e.offsetY-(((C=t.react)==null?void 0:C.shape.y)||0)+(((P=t.react)==null?void 0:P.shape.y)||0)-1,shape:{width:e.offsetX-t.react.shape.x-2,height:2}}),t.circleList[7].attr({x:((z=t.react)==null?void 0:z.shape.x)-1,y:((M=t.react)==null?void 0:M.shape.y)+1,shape:{width:2,height:e.offsetY-((k=t.react)==null?void 0:k.shape.y)-2}}),this.calcText(),this.circleHideOrShow(!0);break}t=null,this.moveReactName=""}rectAddToEventListener(){this.$once("hook:beforeDestroy",()=>{var t;let e;for(let s=0;s<this.rectInsList.length;s++)e=this.rectInsList[s],(t=e.react)==null||t.off("drag",this.rectDrag);e=null})}rectDrag(e){var s,r;console.log("rectDrag",e),this.moveReactName=e.target.name;let t;for(let i=0;i<this.rectInsList.length;i++){if(t=this.rectInsList[i],((s=t.react)==null?void 0:s.name)===this.moveReactName){t.circleList.forEach((h,n)=>{n>3?h.attr({shape:{x:e.target.x,y:e.target.y}}):h.attr({shape:{cx:e.target.x,cy:e.target.y}})}),this.calcText();break}(r=t.react)==null||r.off("drag",this.rectDrag)}t=null,this.moveReactName="",console.log("rectDrag--\u8FD9\u91CC")}circleAddToEventListener(){this.$once("hook:beforeDestroy",()=>{var t;let e;for(let s=0;s<this.rectInsList.length;s++)e=this.rectInsList[s],(t=e.circleList)==null||t.forEach(r=>{r.off("drag",this.circleDrag),r.off("dragstart",this.circleDragStart)});e=null})}circleDragStart(e){var s;console.log("circleDragStart--\u8FD9\u91CC",e),this.moveReactName=e.target.customName;let t;for(let r=0;r<this.rectInsList.length;r++)if(t=this.rectInsList[r],((s=t.react)==null?void 0:s.name)===this.moveReactName){t.circleDragPos.x=e.offsetX,t.circleDragPos.y=e.offsetY;break}t=null,this.moveReactName=""}circleDrag(e){var h,n;console.log("circleDrag--\u8FD9\u91CC",e),this.moveReactName=e.target.customName;const t=parseInt(e.target.name);if(isNaN(t))return;let s,r=0,i=0;for(let l=0;l<this.rectInsList.length;l++)if(s=this.rectInsList[l],((h=s.react)==null?void 0:h.name)===this.moveReactName){r=e.offsetX-s.circleDragPos.x,i=e.offsetY-s.circleDragPos.y,s.circleDragPos.x=e.offsetX,s.circleDragPos.y=e.offsetY;let o=s.react.shape.x,u=s.react.shape.y,a=s.react.shape.width,c=s.react.shape.height;console.log("moveX",r,i),t===0?(o+=r,u+=i,r<0?a+=-r:a-=r,i<0?c+=-i:c-=i,s.circleList[1].attr({y:e.target.y}),s.circleList[3].attr({x:e.target.x}),s.circleList[4].attr({x:e.target.x+1,y:e.target.y-1,shape:{width:a-2}}),s.circleList[7].attr({x:e.target.x-1,y:e.target.y+1,shape:{height:c-2}}),s.circleList[5].attr({y:e.target.y+1,shape:{height:c-2}}),s.circleList[6].attr({x:e.target.x+1,shape:{width:a-2}})):t===1?(u+=i,a+=r,i<0?c+=-i:c-=i,s.circleList[0].attr({y:e.target.y}),s.circleList[2].attr({x:e.target.x}),s.circleList[4].attr({x:e.target.x-a+1,y:e.target.y-1,shape:{width:a-2}}),s.circleList[5].attr({x:e.target.x-1,y:e.target.y+1,shape:{height:c-2}}),s.circleList[6].attr({shape:{width:a-2}}),s.circleList[7].attr({y:e.target.y+1,shape:{height:c-2}})):t===2?(a+=r,c+=i,s.circleList[3].attr({y:e.target.y}),s.circleList[1].attr({x:e.target.x}),s.circleList[5].attr({x:e.target.x-1,shape:{height:c-2}}),s.circleList[6].attr({y:e.target.y-1,shape:{width:a-2}}),s.circleList[4].attr({shape:{width:a-2}}),s.circleList[7].attr({shape:{height:c-2}})):t===3?(o+=r,r<0?a+=-r:a-=r,c+=i,s.circleList[2].attr({y:e.target.y}),s.circleList[0].attr({x:e.target.x}),s.circleList[6].attr({x:e.target.x+1,y:e.target.y-1,shape:{width:a-2}}),s.circleList[7].attr({x:e.target.x-1,shape:{height:c-2}}),s.circleList[4].attr({x:e.target.x+1,shape:{width:a-2}}),s.circleList[5].attr({shape:{height:c-2}})):t===4?(u+=i,i<0?c+=-i:c-=i,s.circleList[0].attr({y:e.target.y+1}),s.circleList[1].attr({y:e.target.y+1}),s.circleList[5].attr({y:e.target.y+2,shape:{height:c-2}}),s.circleList[7].attr({y:e.target.y+2,shape:{height:c-2}}),s.circleList[4].attr({x:o+1})):t===5?(a+=r,s.circleList[1].attr({x:e.target.x+1}),s.circleList[2].attr({x:e.target.x+1}),s.circleList[4].attr({shape:{width:a-2}}),s.circleList[6].attr({shape:{width:a-2}}),s.circleList[5].attr({y:u+1})):t===6?(c+=i,s.circleList[2].attr({y:e.target.y+1}),s.circleList[3].attr({y:e.target.y+1}),s.circleList[5].attr({shape:{height:c-2}}),s.circleList[7].attr({shape:{height:c-2}}),s.circleList[6].attr({x:o+1})):t===7&&(o+=r,r<0?a+=-r:a-=r,s.circleList[0].attr({x:e.target.x+1}),s.circleList[3].attr({x:e.target.x+1}),s.circleList[4].attr({x:e.target.x+2,shape:{width:a-2}}),s.circleList[6].attr({x:e.target.x+2,shape:{width:a-2}}),s.circleList[7].attr({y:u+1})),(n=s.react)==null||n.attr({shape:{x:o,y:u,width:a,height:c}}),this.calcText();break}s=null,this.moveReactName=""}};f([p.Prop({default:()=>""})],exports.default.prototype,"prefixId",2);f([p.Prop({required:!0,type:Number,validator:e=>typeof e=="number"})],exports.default.prototype,"width",2);f([p.Prop({required:!0,type:Number,validator:e=>typeof e=="number"})],exports.default.prototype,"height",2);f([p.Prop({default:()=>({lineW:.6,stroke:"#00C800",circleLineW:1,circleLinestroke:"blue",textColor:"#000",textFontSize:12})})],exports.default.prototype,"config",2);f([p.Prop({required:!0})],exports.default.prototype,"speedValue",2);f([p.Prop({required:!0})],exports.default.prototype,"cellMg",2);f([p.Prop({default:1})],exports.default.prototype,"magnification",2);f([p.Prop({default:1})],exports.default.prototype,"sens",2);f([p.Prop({default:()=>""})],exports.default.prototype,"className",2);exports.default=f([E.default({name:"MXMeasuringRuler"})],exports.default);
3
+ ${s} mV`,x:(((o=e.react)==null?void 0:o.x)||0)+(((u=e.react)==null?void 0:u.shape.x)||0)+(((a=e.react)==null?void 0:a.shape.width)||0)+20,y:(((c=e.react)==null?void 0:c.y)||0)+(((m=e.react)==null?void 0:m.shape.y)||0)}});break}e=null}circleHideOrShow(e){var s;let t;for(let r=0;r<this.rectInsList.length;r++)if(t=this.rectInsList[r],((s=t.react)==null?void 0:s.name)===this.moveReactName){t.circleList.forEach(i=>e?i.show():i.hide());break}t=null}sceneAddToEventListener(){var s,r,i,h,n;const e=l=>{var o;l.event.preventDefault(),this.clearCanvas(),this.initConfig(),(o=this.sceneIns)==null||o.add(this.measuringRulerGroup),this.$emit("notifyMeasuringRuler",{name:"contextmenu"})},t=l=>{var o;this.clearCanvas(),this.initConfig(),(o=this.sceneIns)==null||o.add(this.measuringRulerGroup),this.$emit("notifyMeasuringRuler",{name:"dblclick"})};(s=this.sceneIns)==null||s.on("contextmenu",e),(r=this.sceneIns)==null||r.on("mousedown",this.sceneMousedown),(i=this.sceneIns)==null||i.on("mousemove",this.scenemousemove),(h=this.sceneIns)==null||h.on("mouseup",this.scenemouseup),(n=this.sceneIns)==null||n.on("dblclick",t),this.$once("hook:beforeDestroy",()=>{var l,o,u,a,c;(l=this.sceneIns)==null||l.off("contextmenu",e),(o=this.sceneIns)==null||o.off("mousedown",this.sceneMousedown),(u=this.sceneIns)==null||u.off("mousemove",this.scenemousemove),(a=this.sceneIns)==null||a.off("mouseup",this.scenemouseup),(c=this.sceneIns)==null||c.off("dblclick",t)})}sceneRemoveEventListener(){var e,t,s;(e=this.sceneIns)==null||e.off("mousedown",this.sceneMousedown),(t=this.sceneIns)==null||t.off("mousemove",this.scenemousemove),(s=this.sceneIns)==null||s.off("mouseup",this.scenemouseup)}createRectBox(e,t,s){this.moveReactName=e;const r=new g.Rect({name:e,style:{stroke:this.config.stroke,lineWidth:this.config.lineW,fill:"transparent"},shape:{x:t,y:s},ondrag:this.rectDrag,cursor:"move",draggable:!0}),i=new g.Text({style:{lineHeight:this.config.textFontSize+4,fontSize:this.config.textFontSize,fill:this.config.textColor,fontFamily:this.fontFamily,fontWeight:"bold"}}),h=[];let n;const l=["nw-resize","ne-resize","se-resize","sw-resize","n-resize","e-resize","s-resize","w-resize"];for(let o=0;o<8;o++)o>3?n=new g.Rect({name:`${o}_circle`,customName:e,style:{stroke:this.config.circleLinestroke,lineWidth:this.config.circleLineW,fill:"transparent"},shape:{width:1,height:1},cursor:l[o],zlevel:1,draggable:!0,ondrag:this.circleDrag,ondragstart:this.circleDragStart}):n=new g.Circle({name:`${o}_circle`,customName:e,style:{stroke:this.config.circleLinestroke,lineWidth:this.config.circleLineW,fill:"transparent"},shape:{r:12},cursor:l[o],zlevel:1,draggable:!0,ondrag:this.circleDrag,ondragstart:this.circleDragStart}),n.hide(),this.measuringRulerGroup.add(n),h.push(n);return this.measuringRulerGroup.add(i),this.measuringRulerGroup.add(r),{react:r,text:i,circleList:h,circleDragPos:{x:0,y:0}}}sceneMousedown(e){var t;if(console.log("sceneMousedown",e),e.event.button===0)if(this.isMouseDown=!0,this.rectInsList.length===0)this.rectInsList.push(this.createRectBox("react_1",e.offsetX,e.offsetY));else{let s=!1,r;for(let i=0;i<this.rectInsList.length&&(r=this.rectInsList[i],s=((t=r.react)==null?void 0:t.contain(e.offsetX,e.offsetY))||!1,!s);i++);r=null,s||this.rectInsList.push(this.createRectBox(`react_${this.rectInsList.length+1}`,e.offsetX,e.offsetY)),console.log("isContain",s)}}scenemousemove(e){var s,r;if(!this.isMouseDown)return;let t;for(let i=0;i<this.rectInsList.length;i++)if(t=this.rectInsList[i],((s=t.react)==null?void 0:s.name)===this.moveReactName){(r=t.react)==null||r.attr({shape:{width:e.offsetX-t.react.shape.x,height:e.offsetY-t.react.shape.y}});break}t=null}scenemouseup(e){var s,r,i,h,n,l,o,u,a,c,m,x,d,v,w,I,R,b,D,_,N,C,P,z,M,k;this.isMouseDown=!1;let t;for(let y=0;y<this.rectInsList.length;y++)if(t=this.rectInsList[y],((s=t.react)==null?void 0:s.name)===this.moveReactName){(r=t.react)==null||r.attr({shape:{width:e.offsetX-t.react.shape.x,height:e.offsetY-t.react.shape.y}}),t.circleList[0].attr({x:(i=t.react)==null?void 0:i.shape.x,y:(h=t.react)==null?void 0:h.shape.y}),t.circleList[1].attr({x:e.offsetX-(((n=t.react)==null?void 0:n.shape.x)||0)+(((l=t.react)==null?void 0:l.shape.x)||0),y:(o=t.react)==null?void 0:o.shape.y}),t.circleList[2].attr({x:e.offsetX-(((u=t.react)==null?void 0:u.shape.x)||0)+(((a=t.react)==null?void 0:a.shape.x)||0),y:e.offsetY-(((c=t.react)==null?void 0:c.shape.y)||0)+(((m=t.react)==null?void 0:m.shape.y)||0)}),t.circleList[3].attr({x:(x=t.react)==null?void 0:x.shape.x,y:e.offsetY-(((d=t.react)==null?void 0:d.shape.y)||0)+(((v=t.react)==null?void 0:v.shape.y)||0)}),t.circleList[4].attr({x:((w=t.react)==null?void 0:w.shape.x)+12,y:((I=t.react)==null?void 0:I.shape.y)-1,shape:{width:e.offsetX-t.react.shape.x-24,height:2}}),t.circleList[5].attr({x:e.offsetX-(((R=t.react)==null?void 0:R.shape.x)||0)+(((b=t.react)==null?void 0:b.shape.x)||0)-1,y:((D=t.react)==null?void 0:D.shape.y)+12,shape:{width:2,height:e.offsetY-((_=t.react)==null?void 0:_.shape.y)-24}}),t.circleList[6].attr({x:((N=t.react)==null?void 0:N.shape.x)+12,y:e.offsetY-(((C=t.react)==null?void 0:C.shape.y)||0)+(((P=t.react)==null?void 0:P.shape.y)||0)-1,shape:{width:e.offsetX-t.react.shape.x-24,height:2}}),t.circleList[7].attr({x:((z=t.react)==null?void 0:z.shape.x)-1,y:((M=t.react)==null?void 0:M.shape.y)+12,shape:{width:2,height:e.offsetY-((k=t.react)==null?void 0:k.shape.y)-24}}),this.calcText(),this.circleHideOrShow(!0);break}t=null,this.moveReactName=""}rectAddToEventListener(){this.$once("hook:beforeDestroy",()=>{var t;let e;for(let s=0;s<this.rectInsList.length;s++)e=this.rectInsList[s],(t=e.react)==null||t.off("drag",this.rectDrag);e=null})}rectDrag(e){var s,r;console.log("rectDrag",e),this.moveReactName=e.target.name;let t;for(let i=0;i<this.rectInsList.length;i++){if(t=this.rectInsList[i],((s=t.react)==null?void 0:s.name)===this.moveReactName){t.circleList.forEach((h,n)=>{n>3?h.attr({shape:{x:e.target.x,y:e.target.y}}):h.attr({shape:{cx:e.target.x,cy:e.target.y}})}),this.calcText();break}(r=t.react)==null||r.off("drag",this.rectDrag)}t=null,this.moveReactName="",console.log("rectDrag--\u8FD9\u91CC")}circleAddToEventListener(){this.$once("hook:beforeDestroy",()=>{var t;let e;for(let s=0;s<this.rectInsList.length;s++)e=this.rectInsList[s],(t=e.circleList)==null||t.forEach(r=>{r.off("drag",this.circleDrag),r.off("dragstart",this.circleDragStart)});e=null})}circleDragStart(e){var s;console.log("circleDragStart--\u8FD9\u91CC",e),this.moveReactName=e.target.customName;let t;for(let r=0;r<this.rectInsList.length;r++)if(t=this.rectInsList[r],((s=t.react)==null?void 0:s.name)===this.moveReactName){t.circleDragPos.x=e.offsetX,t.circleDragPos.y=e.offsetY;break}t=null,this.moveReactName=""}circleDrag(e){var h,n;console.log("circleDrag--\u8FD9\u91CC",e),this.moveReactName=e.target.customName;const t=parseInt(e.target.name);if(isNaN(t))return;let s,r=0,i=0;for(let l=0;l<this.rectInsList.length;l++)if(s=this.rectInsList[l],((h=s.react)==null?void 0:h.name)===this.moveReactName){r=e.offsetX-s.circleDragPos.x,i=e.offsetY-s.circleDragPos.y,s.circleDragPos.x=e.offsetX,s.circleDragPos.y=e.offsetY;let o=s.react.shape.x,u=s.react.shape.y,a=s.react.shape.width,c=s.react.shape.height;console.log("moveX",r,i),t===0?(o+=r,u+=i,r<0?a+=-r:a-=r,i<0?c+=-i:c-=i,s.circleList[1].attr({y:e.target.y}),s.circleList[3].attr({x:e.target.x}),s.circleList[4].attr({x:e.target.x+12,y:e.target.y-1,shape:{width:a-24}}),s.circleList[7].attr({x:e.target.x-1,y:e.target.y+12,shape:{height:c-24}}),s.circleList[5].attr({y:e.target.y+12,shape:{height:c-24}}),s.circleList[6].attr({x:e.target.x+12,shape:{width:a-24}})):t===1?(u+=i,a+=r,i<0?c+=-i:c-=i,s.circleList[0].attr({y:e.target.y}),s.circleList[2].attr({x:e.target.x}),s.circleList[4].attr({x:e.target.x-a+12,y:e.target.y-1,shape:{width:a-24}}),s.circleList[5].attr({x:e.target.x-1,y:e.target.y+12,shape:{height:c-24}}),s.circleList[6].attr({shape:{width:a-24}}),s.circleList[7].attr({y:e.target.y+12,shape:{height:c-24}})):t===2?(a+=r,c+=i,s.circleList[3].attr({y:e.target.y}),s.circleList[1].attr({x:e.target.x}),s.circleList[5].attr({x:e.target.x-1,shape:{height:c-24}}),s.circleList[6].attr({y:e.target.y-1,shape:{width:a-24}}),s.circleList[4].attr({shape:{width:a-24}}),s.circleList[7].attr({shape:{height:c-24}})):t===3?(o+=r,r<0?a+=-r:a-=r,c+=i,s.circleList[2].attr({y:e.target.y}),s.circleList[0].attr({x:e.target.x}),s.circleList[6].attr({x:e.target.x+12,y:e.target.y-1,shape:{width:a-24}}),s.circleList[7].attr({x:e.target.x-1,shape:{height:c-24}}),s.circleList[4].attr({x:e.target.x+12,shape:{width:a-24}}),s.circleList[5].attr({shape:{height:c-24}})):t===4?(u+=i,i<0?c+=-i:c-=i,s.circleList[0].attr({y:e.target.y+1}),s.circleList[1].attr({y:e.target.y+1}),s.circleList[5].attr({y:e.target.y+12,shape:{height:c-24}}),s.circleList[7].attr({y:e.target.y+12,shape:{height:c-24}}),s.circleList[4].attr({x:o+12})):t===5?(a+=r,s.circleList[1].attr({x:e.target.x+1}),s.circleList[2].attr({x:e.target.x+1}),s.circleList[4].attr({shape:{width:a-24}}),s.circleList[6].attr({shape:{width:a-24}}),s.circleList[5].attr({y:u+12})):t===6?(c+=i,s.circleList[2].attr({y:e.target.y+1}),s.circleList[3].attr({y:e.target.y+1}),s.circleList[5].attr({shape:{height:c-24}}),s.circleList[7].attr({shape:{height:c-24}}),s.circleList[6].attr({x:o+12})):t===7&&(o+=r,r<0?a+=-r:a-=r,s.circleList[0].attr({x:e.target.x+1}),s.circleList[3].attr({x:e.target.x+1}),s.circleList[4].attr({x:e.target.x+12,shape:{width:a-24}}),s.circleList[6].attr({x:e.target.x+12,shape:{width:a-24}}),s.circleList[7].attr({y:u+12})),(n=s.react)==null||n.attr({shape:{x:o,y:u,width:a,height:c}}),this.calcText();break}s=null,this.moveReactName=""}};f([p.Prop({default:()=>""})],exports.default.prototype,"prefixId",2);f([p.Prop({required:!0,type:Number,validator:e=>typeof e=="number"})],exports.default.prototype,"width",2);f([p.Prop({required:!0,type:Number,validator:e=>typeof e=="number"})],exports.default.prototype,"height",2);f([p.Prop({default:()=>({lineW:.6,stroke:"#00C800",circleLineW:1,circleLinestroke:"blue",textColor:"#000",textFontSize:12})})],exports.default.prototype,"config",2);f([p.Prop({required:!0})],exports.default.prototype,"speedValue",2);f([p.Prop({required:!0})],exports.default.prototype,"cellMg",2);f([p.Prop({default:1})],exports.default.prototype,"magnification",2);f([p.Prop({default:1})],exports.default.prototype,"sens",2);f([p.Prop({default:()=>""})],exports.default.prototype,"className",2);exports.default=f([E.default({name:"MXMeasuringRuler"})],exports.default);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "costy-plus",
3
- "version": "1.1.17-0",
3
+ "version": "1.1.18-0",
4
4
  "main": "dist/lib/index.js",
5
5
  "module": "dist/es/index.js",
6
6
  "types": "dist/es/index.d.ts",