feat: Implement multi-touch drag and long-press stack selection with pointer tracking and physics model documentation.

This commit is contained in:
2025-11-26 22:42:28 +01:00
parent 07e28b3f8d
commit 844e0ed355
2 changed files with 59 additions and 14 deletions
+8 -1
View File
@@ -32,6 +32,7 @@ export class LayoutCard implements LayoutCardState {
public intendedX: number = 0;
public intendedY: number = 0;
private dragOffset: { x: number, y: number } | null = null;
public dragPointerId: number | null = null;
constructor(id: string, store: LayoutStore, initialData: Partial<LayoutCardState> = {}, ref: HTMLElement | null = null) {
this.id = id;
@@ -49,10 +50,11 @@ export class LayoutCard implements LayoutCardState {
this.applyTransform();
}
beginDrag(offset: { x: number, y: number }) {
beginDrag(offset: { x: number, y: number }, pointerId: number) {
this.dragOffset = offset;
this.dragStartX = this.x;
this.dragStartY = this.y;
this.dragPointerId = pointerId;
}
getConstrainedPosition(x: number, y: number): { x: number, y: number } {
@@ -91,6 +93,7 @@ export class LayoutCard implements LayoutCardState {
finishDrag() {
this.dragOffset = null;
this.dragPointerId = null;
}
update(changes: Partial<LayoutCardState>, options: { markDirty?: boolean, isConstraintUpdate?: boolean } = {}) {
@@ -278,6 +281,10 @@ export class LayoutCard implements LayoutCardState {
get centerY(): number {
return this._centerY;
}
get isDragging(): boolean {
return !!this.dragOffset;
}
}
export class LayoutStore {