Skip to content

Commit acf25b1

Browse files
authored
Update main.ts MouseDragComponent
1 parent e89cddc commit acf25b1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -639,9 +639,9 @@ class ChartSystem extends System {
639639
class DOMMouseDragHandler {
640640
initializeDragListeners(entity: Entity) {
641641
const domComponent = entity.getComponent(DOMComponent);
642-
const mouseDrag = entity.getComponent(MouseDragForceComponent);
642+
const mouseDrag = entity.getComponent(MouseDragComponent);
643643
const position = entity.getComponent(PositionComponent);
644-
644+
645645
if (!domComponent || !mouseDrag || !position) return;
646646

647647
const domElement = domComponent.domElement;
@@ -671,7 +671,7 @@ class DOMMouseDragHandler {
671671

672672
onMouseDown(
673673
event: MouseEvent,
674-
mouseDragComponent: MouseDragForceComponent,
674+
mouseDragComponent: MouseDragComponent,
675675
position: PositionComponent,
676676
element: HTMLElement,
677677
) {
@@ -688,7 +688,7 @@ class DOMMouseDragHandler {
688688
); // Set initial target
689689
}
690690

691-
onMouseMove(event: MouseEvent, mouseDragComponent: MouseDragForceComponent) {
691+
onMouseMove(event: MouseEvent, mouseDragComponent: MouseDragComponent) {
692692
if (mouseDragComponent.isDragging) {
693693
// Update the target, accounting for the initial offset
694694
mouseDragComponent.setTarget(
@@ -698,15 +698,15 @@ class DOMMouseDragHandler {
698698
}
699699
}
700700

701-
onMouseUp(mouseDragComponent: MouseDragForceComponent, element: HTMLElement) {
701+
onMouseUp(mouseDragComponent: MouseDragComponent, element: HTMLElement) {
702702
element.classList.remove("dragging");
703703
mouseDragComponent.stopDrag();
704704
}
705705

706706
// Touch event equivalents
707707
onTouchStart(
708708
event: TouchEvent,
709-
mouseDragComponent: MouseDragForceComponent,
709+
mouseDragComponent: MouseDragComponent,
710710
position: PositionComponent,
711711
element: HTMLElement,
712712
) {
@@ -726,7 +726,7 @@ class DOMMouseDragHandler {
726726
); // Set initial target
727727
}
728728

729-
onTouchMove(event: TouchEvent, mouseDragComponent: MouseDragForceComponent) {
729+
onTouchMove(event: TouchEvent, mouseDragComponent: MouseDragComponent) {
730730
if (mouseDragComponent.isDragging) {
731731
event.preventDefault(); // Prevent scrolling
732732
const touch = event.touches[0]; // Get the first touch point
@@ -739,7 +739,7 @@ class DOMMouseDragHandler {
739739
}
740740
}
741741

742-
onTouchEnd(mouseDragComponent: MouseDragForceComponent, element: HTMLElement) {
742+
onTouchEnd(mouseDragComponent: MouseDragComponent, element: HTMLElement) {
743743
element.classList.remove("dragging");
744744
mouseDragComponent.stopDrag();
745745
}

0 commit comments

Comments
 (0)