Commit c8ffafd0 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix: domino drag-drop re-evaluates hit on touchend

When touchend fires without updating pointer coordinates (common in
headless environments and some mobile browsers), the proxy position
is used to re-check endpoint hit test before deciding placement.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 8487c466
......@@ -117,6 +117,20 @@ export class DominoDrag {
document.removeEventListener('pointercancel', this._onUp);
document.removeEventListener('touchend', this._onUp);
// Re-check hit from proxy position (touchend may not update pointer coords)
if (!this.nearEnd && this.proxyEl) {
const left = parseInt(this.proxyEl.style.left) || 0;
const top = parseInt(this.proxyEl.style.top) || 0;
const hit = this.board.hitTestEndpoints(left + 20, top + 35);
if (hit) {
const tileMatches = this.tile.left === hit.value || this.tile.right === hit.value;
if (tileMatches) {
this.nearEnd = hit.end;
this.isValid = true;
}
}
}
this.board.clearGhost();
if (this.nearEnd && this.isValid) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment