@worktile/gantt 15.1.0-next.10 → 15.1.0-next.12
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.
- package/components/bar/bar-drag.d.ts +3 -0
- package/esm2020/components/bar/bar-drag.mjs +12 -6
- package/esm2020/components/bar/bar.component.mjs +4 -2
- package/esm2020/utils/drag-scroll.mjs +20 -1
- package/fesm2015/worktile-gantt.mjs +33 -6
- package/fesm2015/worktile-gantt.mjs.map +1 -1
- package/fesm2020/worktile-gantt.mjs +32 -5
- package/fesm2020/worktile-gantt.mjs.map +1 -1
- package/package.json +1 -1
- package/utils/drag-scroll.d.ts +7 -0
|
@@ -2532,6 +2532,25 @@ function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
|
2532
2532
|
const yThreshold = height * threshold;
|
|
2533
2533
|
return pointerY > top - yThreshold && pointerY < bottom + yThreshold && pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
2534
2534
|
}
|
|
2535
|
+
/**
|
|
2536
|
+
* Gets the speed rate of auto scrolling
|
|
2537
|
+
* @param clientRect Dimensions of the node.
|
|
2538
|
+
* @param pointerX Position of the user's pointer along the x axis.
|
|
2539
|
+
* @param horizontalScrollDirection The direction in which the mouse is dragged horizontally
|
|
2540
|
+
*/
|
|
2541
|
+
function getAutoScrollSpeedRates(clientRect, pointerX, horizontalScrollDirection) {
|
|
2542
|
+
let autoScrollSpeedRates = 4;
|
|
2543
|
+
const speedLevels = 4;
|
|
2544
|
+
const { left, right, width } = clientRect;
|
|
2545
|
+
const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
|
|
2546
|
+
if (horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2547
|
+
autoScrollSpeedRates = Math.ceil((xThreshold - (pointerX > left ? pointerX - left : 0)) / (xThreshold / speedLevels));
|
|
2548
|
+
}
|
|
2549
|
+
if (horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2550
|
+
autoScrollSpeedRates = Math.ceil((xThreshold - (right > pointerX ? right - pointerX : 0)) / (xThreshold / speedLevels));
|
|
2551
|
+
}
|
|
2552
|
+
return autoScrollSpeedRates;
|
|
2553
|
+
}
|
|
2535
2554
|
|
|
2536
2555
|
const scrollThreshold = 50;
|
|
2537
2556
|
var ScrollDirection;
|
|
@@ -2646,7 +2665,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
2646
2665
|
*/
|
|
2647
2666
|
const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
2648
2667
|
const dragMinWidth = 10;
|
|
2649
|
-
const
|
|
2668
|
+
const autoScrollBaseStep = 2;
|
|
2650
2669
|
const activeClass = 'gantt-bar-active';
|
|
2651
2670
|
const dropActiveClass = 'gantt-bar-drop-active';
|
|
2652
2671
|
const singleDropActiveClass = 'gantt-bar-single-drop-active';
|
|
@@ -2665,6 +2684,9 @@ class GanttBarDrag {
|
|
|
2665
2684
|
get barHandleDragMoveAndScrollDistance() {
|
|
2666
2685
|
return this.barHandleDragMoveDistance + this.dragScrollDistance;
|
|
2667
2686
|
}
|
|
2687
|
+
get autoScrollStep() {
|
|
2688
|
+
return Math.pow(autoScrollBaseStep, this.autoScrollSpeedRates);
|
|
2689
|
+
}
|
|
2668
2690
|
constructor(dragDrop, dom, dragContainer, _ngZone) {
|
|
2669
2691
|
this.dragDrop = dragDrop;
|
|
2670
2692
|
this.dom = dom;
|
|
@@ -2684,13 +2706,15 @@ class GanttBarDrag {
|
|
|
2684
2706
|
this.dragScrollDistance = 0;
|
|
2685
2707
|
/** Horizontal direction in which the list is currently scrolling. */
|
|
2686
2708
|
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2709
|
+
/** Speed ratio for auto scroll */
|
|
2710
|
+
this.autoScrollSpeedRates = 1;
|
|
2687
2711
|
this.startScrollInterval = () => {
|
|
2688
2712
|
this.stopScrolling();
|
|
2689
2713
|
interval(0, animationFrameScheduler)
|
|
2690
2714
|
.pipe(takeUntil(this.stopScrollTimers$))
|
|
2691
2715
|
.subscribe(() => {
|
|
2692
2716
|
const node = this.dom.mainContainer;
|
|
2693
|
-
const scrollStep = autoScrollStep;
|
|
2717
|
+
const scrollStep = this.autoScrollStep;
|
|
2694
2718
|
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2695
2719
|
node.scrollBy(-scrollStep, 0);
|
|
2696
2720
|
}
|
|
@@ -2906,10 +2930,10 @@ class GanttBarDrag {
|
|
|
2906
2930
|
let left = dragRect.left - rootRect.left - (this.dom.side.clientWidth + 1);
|
|
2907
2931
|
if (this.dragScrolling) {
|
|
2908
2932
|
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2909
|
-
left += autoScrollStep;
|
|
2933
|
+
left += this.autoScrollStep;
|
|
2910
2934
|
}
|
|
2911
2935
|
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2912
|
-
left -= autoScrollStep;
|
|
2936
|
+
left -= this.autoScrollStep;
|
|
2913
2937
|
}
|
|
2914
2938
|
}
|
|
2915
2939
|
const width = dragRect.right - dragRect.left;
|
|
@@ -3042,6 +3066,7 @@ class GanttBarDrag {
|
|
|
3042
3066
|
(horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */ &&
|
|
3043
3067
|
scrollLeft < this.ganttUpper.view.width - clientRect.width)) {
|
|
3044
3068
|
this._horizontalScrollDirection = horizontalScrollDirection;
|
|
3069
|
+
this.autoScrollSpeedRates = getAutoScrollSpeedRates(clientRect, pointerX, horizontalScrollDirection);
|
|
3045
3070
|
this.dragScrolling = true;
|
|
3046
3071
|
this._ngZone.runOutsideAngular(this.startScrollInterval);
|
|
3047
3072
|
}
|
|
@@ -3225,7 +3250,9 @@ class NgxGanttBarComponent extends GanttItemUpper {
|
|
|
3225
3250
|
if (!this.firstChange) {
|
|
3226
3251
|
this.drag.updateItem(this.item);
|
|
3227
3252
|
if (changes.item.currentValue.refs?.width !== changes.item.previousValue.refs?.width ||
|
|
3228
|
-
changes.item.currentValue.color !== changes.item.previousValue.color
|
|
3253
|
+
changes.item.currentValue.color !== changes.item.previousValue.color ||
|
|
3254
|
+
changes.item.currentValue.start?.value !== changes.item.previousValue.start?.value ||
|
|
3255
|
+
changes.item.currentValue.end?.value !== changes.item.previousValue.end?.value) {
|
|
3229
3256
|
this.setContentBackground();
|
|
3230
3257
|
}
|
|
3231
3258
|
}
|