|
@@ -1,9 +1,18 @@
|
1
|
|
-import {__DEV__} from '../../node_modules/echarts/lib/config';
|
2
|
|
-import * as zrUtil from '../../node_modules/zrender/src/core/util';
|
3
|
|
-import Eventful from '../../node_modules/zrender/src/mixin/Eventful';
|
4
|
|
-import * as graphic from '../../node_modules/echarts/lib/util/graphic';
|
5
|
|
-import * as interactionMutex from '../../node_modules/echarts/lib/component/helper/interactionMutex';
|
6
|
|
-import DataDiffer from '../../node_modules/echarts/lib/data/DataDiffer';
|
|
1
|
+/* eslint-disable */
|
|
2
|
+
|
|
3
|
+var _config = require("../../node_modules/echarts/src/config");
|
|
4
|
+
|
|
5
|
+var __DEV__ = _config.__DEV__;
|
|
6
|
+
|
|
7
|
+var zrUtil = require("../../node_modules/zrender/lib/core/util");
|
|
8
|
+
|
|
9
|
+var Eventful = require("../../node_modules/zrender/lib/mixin/Eventful");
|
|
10
|
+
|
|
11
|
+var graphic = require("../../node_modules/echarts/lib/util/graphic");
|
|
12
|
+
|
|
13
|
+var interactionMutex = require("../../node_modules/echarts/lib/component/helper/interactionMutex");
|
|
14
|
+
|
|
15
|
+var DataDiffer = require("../../node_modules/echarts/lib/data/DataDiffer");
|
7
|
16
|
|
8
|
17
|
/*
|
9
|
18
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@@ -60,6 +69,7 @@ var DEFAULT_BRUSH_OPT = {
|
60
|
69
|
removeOnClick: false
|
61
|
70
|
};
|
62
|
71
|
var baseUID = 0;
|
|
72
|
+
|
63
|
73
|
/**
|
64
|
74
|
* @alias module:echarts/component/helper/BrushController
|
65
|
75
|
* @constructor
|
|
@@ -346,115 +356,115 @@ function endCreating(controller, creatingCover) {
|
346
|
356
|
var coverRenderer = getCoverRenderer(creatingCover);
|
347
|
357
|
|
348
|
358
|
if (coverRenderer.endCreating) {
|
349
|
|
- coverRenderer.endCreating(controller, creatingCover);
|
350
|
|
- updateZ(creatingCover, creatingCover.__brushOption);
|
|
359
|
+ coverRenderer.endCreating(controller, creatingCover)
|
|
360
|
+ updateZ(creatingCover, creatingCover.__brushOption)
|
351
|
361
|
}
|
352
|
362
|
|
353
|
|
- return creatingCover;
|
|
363
|
+ return creatingCover
|
354
|
364
|
}
|
355
|
365
|
|
356
|
366
|
function updateCoverShape(controller, cover) {
|
357
|
|
- var brushOption = cover.__brushOption;
|
358
|
|
- getCoverRenderer(cover).updateCoverShape(controller, cover, brushOption.range, brushOption);
|
|
367
|
+ var brushOption = cover.__brushOption
|
|
368
|
+ getCoverRenderer(cover).updateCoverShape(controller, cover, brushOption.range, brushOption)
|
359
|
369
|
}
|
360
|
370
|
|
361
|
371
|
function updateZ(cover, brushOption) {
|
362
|
|
- var z = brushOption.z;
|
363
|
|
- z == null && (z = COVER_Z);
|
|
372
|
+ var z = brushOption.z
|
|
373
|
+ z == null && (z = COVER_Z)
|
364
|
374
|
cover.traverse(function (el) {
|
365
|
|
- el.z = z;
|
366
|
|
- el.z2 = z; // Consider in given container.
|
367
|
|
- });
|
|
375
|
+ el.z = z
|
|
376
|
+ el.z2 = z // Consider in given container.
|
|
377
|
+ })
|
368
|
378
|
}
|
369
|
379
|
|
370
|
380
|
function updateCoverAfterCreation(controller, cover) {
|
371
|
|
- getCoverRenderer(cover).updateCommon(controller, cover);
|
372
|
|
- updateCoverShape(controller, cover);
|
|
381
|
+ getCoverRenderer(cover).updateCommon(controller, cover)
|
|
382
|
+ updateCoverShape(controller, cover)
|
373
|
383
|
}
|
374
|
384
|
|
375
|
385
|
function getCoverRenderer(cover) {
|
376
|
|
- return coverRenderers[cover.__brushOption.brushType];
|
|
386
|
+ return coverRenderers[cover.__brushOption.brushType]
|
377
|
387
|
} // return target panel or `true` (means global panel)
|
378
|
388
|
|
379
|
389
|
|
380
|
390
|
function getPanelByPoint(controller, e, localCursorPoint) {
|
381
|
|
- var panels = controller._panels;
|
|
391
|
+ var panels = controller._panels
|
382
|
392
|
|
383
|
393
|
if (!panels) {
|
384
|
|
- return true; // Global panel
|
|
394
|
+ return true // Global panel
|
385
|
395
|
}
|
386
|
396
|
|
387
|
|
- var panel;
|
388
|
|
- var transform = controller._transform;
|
|
397
|
+ var panel
|
|
398
|
+ var transform = controller._transform
|
389
|
399
|
each(panels, function (pn) {
|
390
|
|
- pn.isTargetByCursor(e, localCursorPoint, transform) && (panel = pn);
|
391
|
|
- });
|
392
|
|
- return panel;
|
|
400
|
+ pn.isTargetByCursor(e, localCursorPoint, transform) && (panel = pn)
|
|
401
|
+ })
|
|
402
|
+ return panel
|
393
|
403
|
} // Return a panel or true
|
394
|
404
|
|
395
|
405
|
|
396
|
406
|
function getPanelByCover(controller, cover) {
|
397
|
|
- var panels = controller._panels;
|
|
407
|
+ var panels = controller._panels
|
398
|
408
|
|
399
|
409
|
if (!panels) {
|
400
|
|
- return true; // Global panel
|
|
410
|
+ return true // Global panel
|
401
|
411
|
}
|
402
|
412
|
|
403
|
|
- var panelId = cover.__brushOption.panelId; // User may give cover without coord sys info,
|
|
413
|
+ var panelId = cover.__brushOption.panelId // User may give cover without coord sys info,
|
404
|
414
|
// which is then treated as global panel.
|
405
|
415
|
|
406
|
|
- return panelId != null ? panels[panelId] : true;
|
|
416
|
+ return panelId != null ? panels[panelId] : true
|
407
|
417
|
}
|
408
|
418
|
|
409
|
419
|
function clearCovers(controller) {
|
410
|
|
- var covers = controller._covers;
|
411
|
|
- var originalLength = covers.length;
|
|
420
|
+ var covers = controller._covers
|
|
421
|
+ var originalLength = covers.length
|
412
|
422
|
each(covers, function (cover) {
|
413
|
|
- controller.group.remove(cover);
|
414
|
|
- }, controller);
|
415
|
|
- covers.length = 0;
|
416
|
|
- return !!originalLength;
|
|
423
|
+ controller.group.remove(cover)
|
|
424
|
+ }, controller)
|
|
425
|
+ covers.length = 0
|
|
426
|
+ return !!originalLength
|
417
|
427
|
}
|
418
|
428
|
|
419
|
429
|
function trigger(controller, opt) {
|
420
|
430
|
var areas = map(controller._covers, function (cover) {
|
421
|
|
- var brushOption = cover.__brushOption;
|
422
|
|
- var range = zrUtil.clone(brushOption.range);
|
|
431
|
+ var brushOption = cover.__brushOption
|
|
432
|
+ var range = zrUtil.clone(brushOption.range)
|
423
|
433
|
return {
|
424
|
434
|
brushType: brushOption.brushType,
|
425
|
435
|
panelId: brushOption.panelId,
|
426
|
436
|
range: range
|
427
|
|
- };
|
428
|
|
- });
|
|
437
|
+ }
|
|
438
|
+ })
|
429
|
439
|
controller.trigger('brush', areas, {
|
430
|
440
|
isEnd: !!opt.isEnd,
|
431
|
441
|
removeOnClick: !!opt.removeOnClick
|
432
|
|
- });
|
|
442
|
+ })
|
433
|
443
|
}
|
434
|
444
|
|
435
|
445
|
function shouldShowCover(controller) {
|
436
|
|
- var track = controller._track;
|
|
446
|
+ var track = controller._track
|
437
|
447
|
|
438
|
448
|
if (!track.length) {
|
439
|
|
- return false;
|
|
449
|
+ return false
|
440
|
450
|
}
|
441
|
451
|
|
442
|
|
- var p2 = track[track.length - 1];
|
443
|
|
- var p1 = track[0];
|
444
|
|
- var dx = p2[0] - p1[0];
|
445
|
|
- var dy = p2[1] - p1[1];
|
446
|
|
- var dist = mathPow(dx * dx + dy * dy, 0.5);
|
447
|
|
- return dist > UNSELECT_THRESHOLD;
|
|
452
|
+ var p2 = track[track.length - 1]
|
|
453
|
+ var p1 = track[0]
|
|
454
|
+ var dx = p2[0] - p1[0]
|
|
455
|
+ var dy = p2[1] - p1[1]
|
|
456
|
+ var dist = mathPow(dx * dx + dy * dy, 0.5)
|
|
457
|
+ return dist > UNSELECT_THRESHOLD
|
448
|
458
|
}
|
449
|
459
|
|
450
|
460
|
function getTrackEnds(track) {
|
451
|
|
- var tail = track.length - 1;
|
452
|
|
- tail < 0 && (tail = 0);
|
453
|
|
- return [track[0], track[tail]];
|
|
461
|
+ var tail = track.length - 1
|
|
462
|
+ tail < 0 && (tail = 0)
|
|
463
|
+ return [track[0], track[tail]]
|
454
|
464
|
}
|
455
|
465
|
|
456
|
466
|
function createBaseRectCover(doDrift, controller, brushOption, edgeNames) {
|
457
|
|
- var cover = new graphic.Group();
|
|
467
|
+ var cover = new graphic.Group()
|
458
|
468
|
cover.add(new graphic.Rect({
|
459
|
469
|
name: 'main',
|
460
|
470
|
style: makeStyle(brushOption),
|
|
@@ -465,7 +475,7 @@ function createBaseRectCover(doDrift, controller, brushOption, edgeNames) {
|
465
|
475
|
ondragend: curry(trigger, controller, {
|
466
|
476
|
isEnd: true
|
467
|
477
|
})
|
468
|
|
- }));
|
|
478
|
+ }))
|
469
|
479
|
each(edgeNames, function (name) {
|
470
|
480
|
cover.add(new graphic.Rect({
|
471
|
481
|
name: name,
|
|
@@ -479,12 +489,13 @@ function createBaseRectCover(doDrift, controller, brushOption, edgeNames) {
|
479
|
489
|
ondragend: curry(trigger, controller, {
|
480
|
490
|
isEnd: true
|
481
|
491
|
})
|
482
|
|
- }));
|
483
|
|
- });
|
484
|
|
- return cover;
|
|
492
|
+ }))
|
|
493
|
+ })
|
|
494
|
+ return cover
|
485
|
495
|
}
|
486
|
496
|
|
487
|
497
|
function updateBaseRect(controller, cover, localRange, brushOption) {
|
|
498
|
+ // debugger;
|
488
|
499
|
var lineWidth = brushOption.brushStyle.lineWidth || 0
|
489
|
500
|
var handleSize = mathMax(lineWidth, MIN_RESIZE_LINE_WIDTH)
|
490
|
501
|
var x = localRange[0][0]
|
|
@@ -497,9 +508,9 @@ function updateBaseRect(controller, cover, localRange, brushOption) {
|
497
|
508
|
var y2a = y2 - handleSize + lineWidth / 2
|
498
|
509
|
var width = x2 - x;
|
499
|
510
|
var height = y2 - y;
|
500
|
|
- var widtha = width + lineWidth
|
501
|
|
- var heighta = height + lineWidth
|
502
|
|
- updateRectShape(controller, cover, 'main', x, y, width, height)
|
|
511
|
+ var widtha = width + lineWidth;
|
|
512
|
+ var heighta = height + lineWidth;
|
|
513
|
+ updateRectShape(controller, cover, 'main', x, y, width, height);
|
503
|
514
|
|
504
|
515
|
if (brushOption.transformable) {
|
505
|
516
|
// updateRectShape(controller, cover, 'w', xa, ya, handleSize, heighta);
|
|
@@ -514,10 +525,10 @@ function updateBaseRect(controller, cover, localRange, brushOption) {
|
514
|
525
|
}
|
515
|
526
|
|
516
|
527
|
function updateCommon(controller, cover) {
|
517
|
|
- var brushOption = cover.__brushOption;
|
518
|
|
- var transformable = brushOption.transformable;
|
519
|
|
- var mainEl = cover.childAt(0);
|
520
|
|
- mainEl.useStyle(makeStyle(brushOption));
|
|
528
|
+ var brushOption = cover.__brushOption
|
|
529
|
+ var transformable = brushOption.transformable
|
|
530
|
+ var mainEl = cover.childAt(0)
|
|
531
|
+ mainEl.useStyle(makeStyle(brushOption))
|
521
|
532
|
mainEl.attr({
|
522
|
533
|
silent: !transformable,
|
523
|
534
|
cursor: transformable ? 'move' : 'default'
|
|
@@ -534,19 +545,19 @@ function updateCommon(controller, cover) {
|
534
|
545
|
}
|
535
|
546
|
|
536
|
547
|
function updateRectShape(controller, cover, name, x, y, w, h) {
|
537
|
|
- var el = cover.childOfName(name);
|
538
|
|
- el && el.setShape(pointsToRect(clipByPanel(controller, cover, [[x, y], [x + w, y + h]])));
|
|
548
|
+ var el = cover.childOfName(name)
|
|
549
|
+ el && el.setShape(pointsToRect(clipByPanel(controller, cover, [[x, y], [x + w, y + h]])))
|
539
|
550
|
}
|
540
|
551
|
|
541
|
552
|
function makeStyle(brushOption) {
|
542
|
553
|
return zrUtil.defaults({
|
543
|
554
|
strokeNoScale: true
|
544
|
|
- }, brushOption.brushStyle);
|
|
555
|
+ }, brushOption.brushStyle)
|
545
|
556
|
}
|
546
|
557
|
|
547
|
558
|
function formatRectRange(x, y, x2, y2) {
|
548
|
|
- var min = [mathMin(x, x2), mathMin(y, y2)];
|
549
|
|
- var max = [mathMax(x, x2), mathMax(y, y2)];
|
|
559
|
+ var min = [mathMin(x, x2), mathMin(y, y2)]
|
|
560
|
+ var max = [mathMax(x, x2), mathMax(y, y2)]
|
550
|
561
|
return [[min[0], max[0]], // x range
|
551
|
562
|
[min[1], max[1]] // y range
|
552
|
563
|
];
|
|
@@ -558,9 +569,9 @@ function getTransform(controller) {
|
558
|
569
|
|
559
|
570
|
function getGlobalDirection(controller, localDirection) {
|
560
|
571
|
if (localDirection.length > 1) {
|
561
|
|
- localDirection = localDirection.split('');
|
562
|
|
- var globalDir = [getGlobalDirection(controller, localDirection[0]), getGlobalDirection(controller, localDirection[1])];
|
563
|
|
- (globalDir[0] === 'e' || globalDir[0] === 'w') && globalDir.reverse();
|
|
572
|
+ localDirection = localDirection.split('')
|
|
573
|
+ var globalDir = [getGlobalDirection(controller, localDirection[0]), getGlobalDirection(controller, localDirection[1])]
|
|
574
|
+ (globalDir[0] === 'e' || globalDir[0] === 'w') && globalDir.reverse()
|
564
|
575
|
return globalDir.join('');
|
565
|
576
|
} else {
|
566
|
577
|
var map = {
|
|
@@ -575,62 +586,62 @@ function getGlobalDirection(controller, localDirection) {
|
575
|
586
|
top: 'n',
|
576
|
587
|
bottom: 's'
|
577
|
588
|
};
|
578
|
|
- var globalDir = graphic.transformDirection(map[localDirection], getTransform(controller));
|
|
589
|
+ var globalDir = graphic.transformDirection(map[localDirection], getTransform(controller))
|
579
|
590
|
return inverseMap[globalDir];
|
580
|
591
|
}
|
581
|
592
|
}
|
582
|
593
|
|
583
|
594
|
function driftRect(toRectRange, fromRectRange, controller, cover, name, dx, dy, e) {
|
584
|
|
- var brushOption = cover.__brushOption;
|
585
|
|
- var rectRange = toRectRange(brushOption.range);
|
586
|
|
- var localDelta = toLocalDelta(controller, dx, dy);
|
|
595
|
+ var brushOption = cover.__brushOption
|
|
596
|
+ var rectRange = toRectRange(brushOption.range)
|
|
597
|
+ var localDelta = toLocalDelta(controller, dx, dy)
|
587
|
598
|
each(name.split(''), function (namePart) {
|
588
|
|
- var ind = DIRECTION_MAP[namePart];
|
589
|
|
- rectRange[ind[0]][ind[1]] += localDelta[ind[0]];
|
590
|
|
- });
|
591
|
|
- brushOption.range = fromRectRange(formatRectRange(rectRange[0][0], rectRange[1][0], rectRange[0][1], rectRange[1][1]));
|
592
|
|
- updateCoverAfterCreation(controller, cover);
|
|
599
|
+ var ind = DIRECTION_MAP[namePart]
|
|
600
|
+ rectRange[ind[0]][ind[1]] += localDelta[ind[0]]
|
|
601
|
+ })
|
|
602
|
+ brushOption.range = fromRectRange(formatRectRange(rectRange[0][0], rectRange[1][0], rectRange[0][1], rectRange[1][1]))
|
|
603
|
+ updateCoverAfterCreation(controller, cover)
|
593
|
604
|
trigger(controller, {
|
594
|
605
|
isEnd: false
|
595
|
|
- });
|
|
606
|
+ })
|
596
|
607
|
}
|
597
|
608
|
|
598
|
609
|
function driftPolygon(controller, cover, dx, dy, e) {
|
599
|
610
|
var range = cover.__brushOption.range;
|
600
|
|
- var localDelta = toLocalDelta(controller, dx, dy);
|
|
611
|
+ var localDelta = toLocalDelta(controller, dx, dy)
|
601
|
612
|
each(range, function (point) {
|
602
|
|
- point[0] += localDelta[0];
|
603
|
|
- point[1] += localDelta[1];
|
604
|
|
- });
|
605
|
|
- updateCoverAfterCreation(controller, cover);
|
|
613
|
+ point[0] += localDelta[0]
|
|
614
|
+ point[1] += localDelta[1]
|
|
615
|
+ })
|
|
616
|
+ updateCoverAfterCreation(controller, cover)
|
606
|
617
|
trigger(controller, {
|
607
|
618
|
isEnd: false
|
608
|
|
- });
|
|
619
|
+ })
|
609
|
620
|
}
|
610
|
621
|
|
611
|
622
|
function toLocalDelta(controller, dx, dy) {
|
612
|
623
|
var thisGroup = controller.group;
|
613
|
|
- var localD = thisGroup.transformCoordToLocal(dx, dy);
|
614
|
|
- var localZero = thisGroup.transformCoordToLocal(0, 0);
|
615
|
|
- return [localD[0] - localZero[0], localD[1] - localZero[1]];
|
|
624
|
+ var localD = thisGroup.transformCoordToLocal(dx, dy)
|
|
625
|
+ var localZero = thisGroup.transformCoordToLocal(0, 0)
|
|
626
|
+ return [localD[0] - localZero[0], localD[1] - localZero[1]]
|
616
|
627
|
}
|
617
|
628
|
|
618
|
629
|
function clipByPanel(controller, cover, data) {
|
619
|
|
- var panel = getPanelByCover(controller, cover);
|
620
|
|
- return panel && panel !== true ? panel.clipPath(data, controller._transform) : zrUtil.clone(data);
|
|
630
|
+ var panel = getPanelByCover(controller, cover)
|
|
631
|
+ return panel && panel !== true ? panel.clipPath(data, controller._transform) : zrUtil.clone(data)
|
621
|
632
|
}
|
622
|
633
|
|
623
|
634
|
function pointsToRect(points) {
|
624
|
|
- var xmin = mathMin(points[0][0], points[1][0]);
|
625
|
|
- var ymin = mathMin(points[0][1], points[1][1]);
|
626
|
|
- var xmax = mathMax(points[0][0], points[1][0]);
|
627
|
|
- var ymax = mathMax(points[0][1], points[1][1]);
|
|
635
|
+ var xmin = mathMin(points[0][0], points[1][0])
|
|
636
|
+ var ymin = mathMin(points[0][1], points[1][1])
|
|
637
|
+ var xmax = mathMax(points[0][0], points[1][0])
|
|
638
|
+ var ymax = mathMax(points[0][1], points[1][1])
|
628
|
639
|
return {
|
629
|
640
|
x: xmin,
|
630
|
641
|
y: ymin,
|
631
|
642
|
width: xmax - xmin,
|
632
|
643
|
height: ymax - ymin
|
633
|
|
- };
|
|
644
|
+ }
|
634
|
645
|
}
|
635
|
646
|
|
636
|
647
|
function resetCursor(controller, e, localCursorPoint) {
|
|
@@ -639,9 +650,9 @@ function resetCursor(controller, e, localCursorPoint) {
|
639
|
650
|
return;
|
640
|
651
|
}
|
641
|
652
|
|
642
|
|
- var zr = controller._zr;
|
643
|
|
- var covers = controller._covers;
|
644
|
|
- var currPanel = getPanelByPoint(controller, e, localCursorPoint); // Check whether in covers.
|
|
653
|
+ var zr = controller._zr
|
|
654
|
+ var covers = controller._covers
|
|
655
|
+ var currPanel = getPanelByPoint(controller, e, localCursorPoint) // Check whether in covers.
|
645
|
656
|
|
646
|
657
|
if (!controller._dragging) {
|
647
|
658
|
for (var i = 0; i < covers.length; i++) {
|
|
@@ -649,53 +660,53 @@ function resetCursor(controller, e, localCursorPoint) {
|
649
|
660
|
|
650
|
661
|
if (currPanel && (currPanel === true || brushOption.panelId === currPanel.panelId) && coverRenderers[brushOption.brushType].contain(covers[i], localCursorPoint[0], localCursorPoint[1])) {
|
651
|
662
|
// Use cursor style set on cover.
|
652
|
|
- return;
|
|
663
|
+ return
|
653
|
664
|
}
|
654
|
665
|
}
|
655
|
666
|
}
|
656
|
667
|
|
657
|
|
- currPanel && zr.setCursorStyle('crosshair');
|
|
668
|
+ currPanel && zr.setCursorStyle('crosshair')
|
658
|
669
|
}
|
659
|
670
|
|
660
|
671
|
function preventDefault(e) {
|
661
|
672
|
var rawE = e.event;
|
662
|
|
- rawE.preventDefault && rawE.preventDefault();
|
|
673
|
+ rawE.preventDefault && rawE.preventDefault()
|
663
|
674
|
}
|
664
|
675
|
|
665
|
676
|
function mainShapeContain(cover, x, y) {
|
666
|
|
- return cover.childOfName('main').contain(x, y);
|
|
677
|
+ return cover.childOfName('main').contain(x, y)
|
667
|
678
|
}
|
668
|
679
|
|
669
|
680
|
function updateCoverByMouse(controller, e, localCursorPoint, isEnd) {
|
670
|
|
- var creatingCover = controller._creatingCover;
|
671
|
|
- var panel = controller._creatingPanel;
|
672
|
|
- var thisBrushOption = controller._brushOption;
|
673
|
|
- var eventParams;
|
|
681
|
+ var creatingCover = controller._creatingCover
|
|
682
|
+ var panel = controller._creatingPanel
|
|
683
|
+ var thisBrushOption = controller._brushOption
|
|
684
|
+ var eventParams
|
674
|
685
|
|
675
|
|
- controller._track.push(localCursorPoint.slice());
|
|
686
|
+ controller._track.push(localCursorPoint.slice())
|
676
|
687
|
|
677
|
688
|
if (shouldShowCover(controller) || creatingCover) {
|
678
|
689
|
if (panel && !creatingCover) {
|
679
|
|
- thisBrushOption.brushMode === 'single' && clearCovers(controller);
|
680
|
|
- var brushOption = zrUtil.clone(thisBrushOption);
|
681
|
|
- brushOption.brushType = determineBrushType(brushOption.brushType, panel);
|
|
690
|
+ thisBrushOption.brushMode === 'single' && clearCovers(controller)
|
|
691
|
+ var brushOption = zrUtil.clone(thisBrushOption)
|
|
692
|
+ brushOption.brushType = determineBrushType(brushOption.brushType, panel)
|
682
|
693
|
brushOption.panelId = panel === true ? null : panel.panelId;
|
683
|
|
- creatingCover = controller._creatingCover = createCover(controller, brushOption);
|
|
694
|
+ creatingCover = controller._creatingCover = createCover(controller, brushOption)
|
684
|
695
|
|
685
|
|
- controller._covers.push(creatingCover);
|
|
696
|
+ controller._covers.push(creatingCover)
|
686
|
697
|
}
|
687
|
698
|
|
688
|
699
|
if (creatingCover) {
|
689
|
|
- var coverRenderer = coverRenderers[determineBrushType(controller._brushType, panel)];
|
690
|
|
- var coverBrushOption = creatingCover.__brushOption;
|
691
|
|
- coverBrushOption.range = coverRenderer.getCreatingRange(clipByPanel(controller, creatingCover, controller._track));
|
|
700
|
+ var coverRenderer = coverRenderers[determineBrushType(controller._brushType, panel)]
|
|
701
|
+ var coverBrushOption = creatingCover.__brushOption
|
|
702
|
+ coverBrushOption.range = coverRenderer.getCreatingRange(clipByPanel(controller, creatingCover, controller._track))
|
692
|
703
|
|
693
|
704
|
if (isEnd) {
|
694
|
|
- endCreating(controller, creatingCover);
|
695
|
|
- coverRenderer.updateCommon(controller, creatingCover);
|
|
705
|
+ endCreating(controller, creatingCover)
|
|
706
|
+ coverRenderer.updateCommon(controller, creatingCover)
|
696
|
707
|
}
|
697
|
708
|
|
698
|
|
- updateCoverShape(controller, creatingCover);
|
|
709
|
+ updateCoverShape(controller, creatingCover)
|
699
|
710
|
eventParams = {
|
700
|
711
|
isEnd: isEnd
|
701
|
712
|
};
|
|
@@ -714,7 +725,7 @@ function updateCoverByMouse(controller, e, localCursorPoint, isEnd) {
|
714
|
725
|
}
|
715
|
726
|
}
|
716
|
727
|
|
717
|
|
- return eventParams;
|
|
728
|
+ return eventParams
|
718
|
729
|
}
|
719
|
730
|
|
720
|
731
|
function determineBrushType(brushType, panel) {
|
|
@@ -730,12 +741,12 @@ var mouseHandlers = {
|
730
|
741
|
if (this._dragging) {
|
731
|
742
|
// In case some browser do not support globalOut,
|
732
|
743
|
// and release mose out side the browser.
|
733
|
|
- handleDragEnd.call(this, e);
|
|
744
|
+ handleDragEnd.call(this, e)
|
734
|
745
|
} else if (!e.target || !e.target.draggable) {
|
735
|
|
- preventDefault(e);
|
736
|
|
- var localCursorPoint = this.group.transformCoordToLocal(e.offsetX, e.offsetY);
|
737
|
|
- this._creatingCover = null;
|
738
|
|
- var panel = this._creatingPanel = getPanelByPoint(this, e, localCursorPoint);
|
|
746
|
+ preventDefault(e)
|
|
747
|
+ var localCursorPoint = this.group.transformCoordToLocal(e.offsetX, e.offsetY)
|
|
748
|
+ this._creatingCover = null
|
|
749
|
+ var panel = this._creatingPanel = getPanelByPoint(this, e, localCursorPoint)
|
739
|
750
|
|
740
|
751
|
if (panel) {
|
741
|
752
|
this._dragging = true;
|
|
@@ -875,4 +886,5 @@ function getLineRenderer(xyIndex) {
|
875
|
886
|
}
|
876
|
887
|
|
877
|
888
|
var _default = BrushController;
|
|
889
|
+// debugger
|
878
|
890
|
module.exports = _default;
|