Fence pointer capture ownership across node and edge gestures

This commit is contained in:
2026-11-09 18:35:43 +08:00
parent 2f385433be
commit 0813b8df53
8 changed files with 71 additions and 35 deletions
+2
View File
@@ -192,6 +192,8 @@ try {
const corner = await evaluate(`(()=>{const r=document.querySelector('.react-flow__node[data-id=b] [aria-label="拖动右下角调整大小"]').getBoundingClientRect();return {x:r.x+r.width/2,y:r.y+r.height/2}})()`);
await call('Input.dispatchMouseEvent', { type: 'mousePressed', x: corner.x, y: corner.y, button: 'left', buttons: 1, clickCount: 1 });
await call('Input.dispatchMouseEvent', { type: 'mouseMoved', x: corner.x + 20, y: corner.y + 10, button: 'left', buttons: 1 });
await evaluate(`(()=>{const handle=document.querySelector('.react-flow__node[data-id=b] [aria-label="拖动右下角调整大小"]');for(const type of ['pointermove','pointerup','pointercancel','lostpointercapture'])handle.dispatchEvent(new PointerEvent(type,{pointerId:999,clientX:9999,clientY:9999,bubbles:true,cancelable:true}));})()`);
assert.equal(calls.filter(call=>call.method==='POST'&&call.path.endsWith('/model/operations')).length,beforeCancel,'foreign pointer committed the resize');
await call('Input.dispatchMouseEvent', { type: 'mouseReleased', x: corner.x + 40, y: corner.y + 20, button: 'left', buttons: 0 });
for (let i=0;i<100&&documents.get(root).elements.get('b').geometry.width!==300;i++)await pause(20);
assert.equal(documents.get(root).elements.get('b').geometry.width,300,JSON.stringify({geometry:documents.get(root).elements.get('b').geometry,inputs:await evaluate('window.inputEvents'),text:await evaluate('document.body.innerText')}));assert.equal(documents.get(root).elements.get('b').geometry.height,220);