feat: Implement multi-touch drag and long-press stack selection with pointer tracking and physics model documentation.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user