diff --git a/site/preview-v2/assets/mixer-wire-dots.css b/site/preview-v2/assets/mixer-wire-dots.css index f3f610f74..46a64249a 100644 --- a/site/preview-v2/assets/mixer-wire-dots.css +++ b/site/preview-v2/assets/mixer-wire-dots.css @@ -832,11 +832,18 @@ #wireLayer path.wire-incoming-line.is-wire-selected, #wireLayer path.wire-outgoing-line.is-wire-selected, #wireLayer path.wire-context-line.is-wire-selected{ - stroke:color-mix(in srgb,var(--wire-selected-hue,#88dfff) 54%,#ffffff 46%)!important; - stroke-width:5.6px!important;opacity:1!important; + stroke:color-mix(in srgb,var(--wire-selected-hue,#88dfff) 78%,#ffffff 22%)!important; + stroke-width:3.45px!important;opacity:.98!important; stroke-dasharray:none!important; filter:none!important; } +/* A cable being actively pulled is already the operator's selected cable; + its preview uses the same quiet highlight as an accepted cable, never glow. */ +#wireLayer path.wire-drag-line.is-wire-selected{ + stroke:color-mix(in srgb,var(--wire-selected-hue,#88dfff) 78%,#ffffff 22%)!important; + stroke-width:3.45px!important;opacity:.98!important; + stroke-dasharray:none!important;filter:none!important; +} /* Source selection is temporary intent, while cable connection derives only from the committed route model. No phantom lit output without an edge. */ .console-body.wire-routing-v15:not(.wire-intent):not(.wire-dragging) diff --git a/site/preview-v2/index.html b/site/preview-v2/index.html index 6d016cdc0..8ca3bf161 100644 --- a/site/preview-v2/index.html +++ b/site/preview-v2/index.html @@ -355,6 +355,16 @@ if(!result.ok){say('ROUTING GUARDIAN: '+result.error+' · graph unchanged');return false;} wireEdges=result.edges;nextWireId=result.nextId; if(selectedWireEdgeId!==null&&!wireEdges.some(e=>e.id===selectedWireEdgeId))selectedWireEdgeId=null; + // Every accepted plug/retarget becomes the selected committed EdgeId, + // irrespective of click, drag, Bus route choice, Matrix or SOF workflow. + // Invalid/canceled operations never touch selection. + const accepted=ops.filter(op=>['CONNECT','ROUTE_ONLY','RETARGET'].includes(op.type)).at(-1); + if(accepted){ + const committed=accepted.edgeId!=null? + wireEdges.find(e=>e.enabled&&e.id===accepted.edgeId&&e.destId===accepted.destId): + wireEdges.find(e=>e.enabled&&e.sourceId===accepted.sourceId&&e.destId===accepted.destId); + if(committed)selectedWireEdgeId=committed.id; + } syncWireOutputProjection(); if(record)wireWsRecord(before); return true; @@ -904,35 +914,37 @@ wireMotionGeometry.set(key,[x0,y0,x1,y1,limit]); return wirePathData(x0,y0,x1,y1,limit,wireMotion.key===key?wireMotion.offset:0); } -/* V60 tactile patch cable: one short full-span impact OUT -> IN. - The physical endpoints stay welded to the socket centers throughout. - The packet travels along the full normalized curve in 460ms, then the - cable settles in 190ms. No idle animation or graph/PCM writes. */ -const WIRE_IMPACT_TRAVEL_MS=460,WIRE_IMPACT_SETTLE_MS=190; +/* V61 real cable whip: a short upward flick at the receiving IN socket, + travelling back toward the OUT plug with a damped sinusoidal tail. + Physical plugs stay welded; amplitude and oscillation decay toward OUT. + Only a committed/retargeted cable animates, for a bounded half-second. */ +const WIRE_IMPACT_TRAVEL_MS=330,WIRE_IMPACT_SETTLE_MS=170; const WIRE_IMPACT_DURATION_MS=WIRE_IMPACT_TRAVEL_MS+WIRE_IMPACT_SETTLE_MS; function wireImpactPathData(x0,y0,x1,y1,limit,elapsedMs){ const span=Math.abs(x1-x0),ceiling=Math.max(12,Math.min(100,Number(limit)||72)); const sag=Math.max(10,Math.min(ceiling,Math.min(ceiling-5,28+Math.sqrt(span)*1.55))); const c=sag*4/3; - const sweep=Math.max(0,Math.min(1,elapsedMs/WIRE_IMPACT_TRAVEL_MS)); - // The impulse center actually reaches the receiving plug rather than - // disappearing halfway through from exponential travel attenuation. - const center=.035+.93*sweep; + const u=Math.max(0,Math.min(1,elapsedMs/WIRE_IMPACT_TRAVEL_MS)); + // Physical launch occurs at the IN end (t=1), never at OUT (t=0). + // Ease-out front makes the receiving plug flick briskly, rather than creep. + const front=1-Math.pow(1-u,1.55); const settle=Math.max(0,Math.min(1,(elapsedMs-WIRE_IMPACT_TRAVEL_MS)/WIRE_IMPACT_SETTLE_MS)); - const amplitude=15.2*Math.pow(1-settle,2); + const fade=Math.pow(1-settle,2); + const strength=Math.min(22,Math.max(14,Math.sqrt(span)*1.6))*fade; let d='M '+x0.toFixed(1)+' '+y0.toFixed(1); - for(let i=1;i<=56;i++){ - const t=i/56,u=1-t; - const x=u*u*u*x0+3*u*u*t*x0+3*u*t*t*x1+t*t*t*x1; - const y=u*u*u*y0+3*u*u*t*(y0+c)+3*u*t*t*(y1+c)+t*t*t*y1; - const dx=6*u*t*(x1-x0),dy=3*u*u*c+6*u*t*(y1-y0)+3*t*t*(-c); - const norm=Math.hypot(dx,dy)||1,delta=t-center; - // A bounded, springy packet with no seam at the two fixed plugs. - // Preserve visible displacement all the way to 96% of cable length. - const tether=Math.min(1,t/.035,(1-t)/.035); - const packet=Math.exp(-(delta*delta)/(.145*.145)); - const impulse=amplitude*packet*Math.cos(delta*13-sweep*1.4)*tether; - d+=' L '+(x-dy/norm*impulse).toFixed(1)+' '+(y+dx/norm*impulse).toFixed(1); + for(let i=1;i<=64;i++){ + const t=i/64,v=1-t; + const x=v*v*v*x0+3*v*v*t*x0+3*v*t*t*x1+t*t*t*x1; + const y=v*v*v*y0+3*v*v*t*(y0+c)+3*v*t*t*(y1+c)+t*t*t*y1; + const distance=1-t; // distance travelled from IN toward OUT + const passed=front-distance; // material behind the advancing wavefront + const tether=Math.min(1,t/.025,(1-t)/.025); + // Finite causal travelling sine: first lobe moves UP at the IN socket, + // trailing lobes alternate and decay over time AND along cable length. + const wave=passed>0? + -strength*Math.sin(2*Math.PI*passed/.34)* + Math.exp(-2.2*passed-1.35*distance)*tether:0; + d+=' L '+x.toFixed(1)+' '+(y+wave).toFixed(1); } return d; } @@ -1520,7 +1532,7 @@ } const d=wirePathData(x0,y0,x1,y1,sagLimit); paths.push(''+ - ''+ + ''+ (snap?'':'')); } svg.innerHTML=paths.join(''); @@ -1776,13 +1788,12 @@ else if(field==='pan'){ let value=Number(el.value);if(!Number.isFinite(value))return; value=Math.max(-100,Math.min(100,value)); - // Hardware-like center detent: capture inside ±7, hold through ±12, - // release outside ±12. A finished drag inside ±12 snaps to dead center. - // Keyboard arrows remain fine-resolution (bypass sticky detent). + // V61 stronger tactile PAN center: capture ±14, hold through ±22, + // release inside ±18. Alt bypass and keyboard fine increments remain exact. const keyboard=el.dataset.panKeyboard==='true'; const bypass=!!event.altKey||el.dataset.panAltPointer==='true'; const latched=el.dataset.panDetent==='true'; - const range=event.type==='change'?12:latched?12:7; + const range=event.type==='change'?18:latched?22:14; if(!keyboard&&!bypass&&Math.abs(value)<=range){value=0;el.value='0';} el.dataset.panDetent=String(!keyboard&&value===0&&!bypass); if(event.type==='change')delete el.dataset.panKeyboard; @@ -1924,7 +1935,9 @@ const g=wireGesture; if(!Number.isFinite(ev.clientX)||!Number.isFinite(ev.clientY))return; if(!g.active&&Math.hypot(ev.clientX-g.startX,ev.clientY-g.startY)>=(g.movingEdgeId!==null?10:5)){ - g.active=true;wireHoverId=null; // source selection changes only on an accepted drop + g.active=true;wireHoverId=null; + if(g.movingEdgeId!==null)selectedWireEdgeId=g.movingEdgeId; + // The cable is visually selected while dragging; graph still changes only on accepted drop. if(g.movingEdgeId!==null)consoleBody.querySelector?.('.strip[data-id="'+g.originDestId+'"] .wire-node-in')?.classList.add('is-replug-origin'); consoleBody.classList.add('wire-dragging'); consoleBody.querySelector?.('.strip[data-id="'+g.sourceId+'"] .wire-node-out')?.classList.add('is-drag-origin'); @@ -1959,7 +1972,7 @@ const before=wireWsSnapshot(); if(replugWireEdge(g.sourceId,g.originDestId,snap?.track.id??null)){ wireWsRecord(before); - selectedWireEdgeId=snap?g.movingEdgeId:null; + if(!snap)selectedWireEdgeId=null; } } }else{ diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs index ce2c812c2..4db946871 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -675,7 +675,7 @@ test("P0 typed mono-stereo, PAN detent, fader geometry & FX failure diagnostics" assert.match(nativeBundle,/faderDbFromTravelPercent\(100\*\(1-frac\),max===6\)/); assert.doesNotMatch(page,/FADER_TAPER/, "public Pages reference remains immutable"); assert.match(bridge,/function previewNativePan\(t,el,event\)/); - assert.match(bridge,/const width=event\.type==="change"\?12:latched\?12:7/); + assert.match(bridge,/const width=event\.type==="change"\?18:latched\?22:14/); assert.match(bridge,/readout\.textContent=value===0\?"C"/); assert.match(bridge,/function requestProcessingFormat\(t\)/); assert.match(bridge,/operation:"SET_PROCESSING_FORMAT"/); diff --git a/tests/pages_v60_fader_wire_tactile_smoke.py b/tests/pages_v60_fader_wire_tactile_smoke.py index 7b7fc312c..757e2e758 100644 --- a/tests/pages_v60_fader_wire_tactile_smoke.py +++ b/tests/pages_v60_fader_wire_tactile_smoke.py @@ -22,9 +22,12 @@ def source_contract(): for text in ("FADER_UNITY_CAPTURE_PX=7,FADER_UNITY_RELEASE_PX=12", "gesture.unityLatched=true", "if(!ev.altKey&&Math.abs", "handleField({target:g.input,type:'change'", - "WIRE_IMPACT_TRAVEL_MS=460,WIRE_IMPACT_SETTLE_MS=190", - "const center=.035+.93*sweep", - "const tether=Math.min(1,t/.035,(1-t)/.035)", + "WIRE_IMPACT_TRAVEL_MS=330,WIRE_IMPACT_SETTLE_MS=170", + "const distance=1-t; // distance travelled from IN toward OUT", + "const wave=passed>0?", + "const accepted=ops.filter(op=>['CONNECT','ROUTE_ONLY','RETARGET'].includes(op.type)).at(-1)", + "wire-drag-line is-wire-selected", + "latched?22:14", "line.style.setProperty('--wire-selected-hue'"): assert text in HTML,("missing tactile contract",text) assert "elapsed<1600" not in HTML @@ -34,7 +37,11 @@ def source_contract(): assert "--fader-fixed-h:clamp(" not in FADER assert "--v13-fader-h:clamp(198px" not in CHROME assert "stroke:transparent!important;" in WIRE - assert "stroke-width:5.6px!important;opacity:1!important;" in WIRE + assert "stroke-width:3.45px!important;opacity:.98!important;" in WIRE + assert "78%,#ffffff 22%" in WIRE + assert "#wireLayer path.wire-drag-line.is-wire-selected{" in WIRE + BRIDGE=(ROOT/"web/approved-native-bridge.js").read_text("utf-8") + assert 'event.type==="change"?18:latched?22:14' in BRIDGE assert "stroke-dasharray:none!important;" in WIRE print("PASS V60 fast source contract: detent / tall rail / full-span impulse / selected jacket") @@ -106,6 +113,33 @@ def exercise(page,width,height): return layout +def test_pan(page): + # Real DOM input events, native-style hysteresis semantics, and bypass. + pan=page.locator('#tracks .strip[data-id="1"] .center-pan') + pan.wait_for() + def value(v): + pan.evaluate("""(el,val)=>{ + el.value=String(val); + el.dispatchEvent(new Event('input',{bubbles:true})); + }""",v) + return float(pan.input_value()) + assert value(12)==0,("PAN failed to capture center",pan.input_value()) + assert value(20)==0,("PAN lost center too early",pan.input_value()) + assert value(29)==29,("PAN cannot escape sticky detent",pan.input_value()) + assert value(16)==16,("PAN outside capture should remain adjustable",pan.input_value()) + pan.evaluate("(el)=>el.dispatchEvent(new Event('change',{bubbles:true}))") + assert float(pan.input_value())==0,"PAN should settle to center on release" + # Keyboard arrow remains fine-step, independent of drag snapping. + pan.focus() + page.keyboard.press("ArrowRight") + assert 0{el.dataset.panAltPointer='true';}") + assert value(8)==8,"Alt/pointer fine PAN bypass was lost" + pan.evaluate("(el)=>delete el.dataset.panAltPointer") + assert value(-8)==0,"PAN reverse side must also snap" + assert pan.get_attribute("aria-valuetext")=="Center" + + def test_wire(page): # The SEND bay can be folded by default on the assembled preview. # Use the actual operator rail to reveal the physical sockets. @@ -141,6 +175,33 @@ def test_wire(page): cable.wait_for(state="attached",timeout=8000) page.wait_for_timeout(850) samples=page.evaluate("window.__v60WireSamples") + # Deterministic physical direction: first visible UP kick near IN, + # OUT remains quiet initially; then the decayed crest reaches near OUT. + physics=page.evaluate("""()=>{ + const g=wireMotionGeometry.get('1-3'); + if(!g)return null; + const [x0,y0,x1,y1,limit]=g; + const span=Math.abs(x1-x0),ceiling=Math.max(12,Math.min(100,Number(limit)||72)); + const sag=Math.max(10,Math.min(ceiling,Math.min(ceiling-5,28+Math.sqrt(span)*1.55))); + const c=sag*4/3; + const baseline=t=>{ + const v=1-t; + return v*v*v*y0+3*v*v*t*(y0+c)+3*v*t*t*(y1+c)+t*t*t*y1; + }; + const displaced=(ms,i)=>{ + const points=wireImpactPathData(...g,ms).match(/-?\\d+(?:\\.\\d+)?/g).map(Number); + return points[2*i+1]-baseline(i/64); + }; + return { + nearInEarly:displaced(45,60),nearOutEarly:displaced(45,10), + nearOutLate:displaced(270,10), + pluggedOut:displaced(0,0),pluggedIn:displaced(45,64) + }; + }""") + assert physics and physics["nearInEarly"]< -2.5,("no upward jerk at receiving IN",physics) + assert abs(physics["nearOutEarly"])<.5,("wrong direction: OUT moves first",physics) + assert physics["nearOutLate"]< -1.2,("wave stops before OUT",physics) + assert abs(physics["pluggedOut"])<.25 and abs(physics["pluggedIn"])<.25,physics assert len(samples)>=5,("no finite spring movement",len(samples)) assert any(" L " in x["d"] for x in samples),("no cable impact",len(samples)) settled=cable.get_attribute("d") @@ -157,8 +218,12 @@ def test_wire(page): hit=page.locator('#wireLayer path.wire-interaction-hit[data-cable-key="1-3"]') assert hit.count()==1 + # The newly plugged edge is selected immediately, before the user clicks it. + assert page.locator('#wireLayer path.wire-outgoing-line[data-from="1"][data-to="3"].is-wire-selected').count()==1 + initial_edge=hit.get_attribute("data-edge-id") mid=point_at_midpoint(hit) page.mouse.click(mid["x"],mid["y"]) + assert hit.get_attribute("data-edge-id")==initial_edge selected=page.locator('#wireLayer path.wire-outgoing-line[data-from="1"][data-to="3"].is-wire-selected,#wireLayer path.wire-incoming-line[data-from="1"][data-to="3"].is-wire-selected') assert selected.count()==1,"Selected edge must brighten its real visible jacket" values=selected.evaluate("""el=>{ @@ -168,12 +233,32 @@ def test_wire(page): original:el.getAttribute('stroke'),dash:c.strokeDasharray, filter:c.filter,hit:getComputedStyle(hit).stroke}; }""") - assert values["width"]>=5.5 and values["dash"]=="none",values + assert 3.35<=values["width"]<=3.55 and values["dash"]=="none",values assert values["stroke"]!=values["original"],values assert values["filter"]=="none",values assert values["hit"] in ("transparent","rgba(0, 0, 0, 0)"),values # Re-selecting does not alter source/destination graph identity. - assert hit.get_attribute("data-edge-id") + assert hit.get_attribute("data-edge-id")==initial_edge + # Start a NEW cable with a real pointer drag: preview is selected even + # before graph acceptance. Once plugged it retains its exact EdgeId. + out=page.locator('#tracks .strip[data-id="1"] .wire-node-out') + dest=page.locator('#tracks .strip[data-id="4"] .wire-node-in') + a=out.bounding_box() + b=dest.bounding_box() + assert a and b,("need two visible physical sockets",a,b) + page.mouse.move(a["x"]+a["width"]/2,a["y"]+a["height"]/2) + page.mouse.down() + page.mouse.move(b["x"]+b["width"]/2,b["y"]+b["height"]/2,steps=8) + drag=page.locator('#wireLayer path.wire-drag-line.is-wire-selected') + assert drag.count()==1,"New wire is not highlighted during drag" + drag_style=drag.evaluate("(el)=>({width:parseFloat(getComputedStyle(el).strokeWidth),opacity:getComputedStyle(el).opacity,filter:getComputedStyle(el).filter})") + assert 3.35<=drag_style["width"]<=3.55 and drag_style["filter"]=="none",drag_style + page.mouse.up() + plugged=page.locator('#wireLayer path.wire-outgoing-line[data-from="1"][data-to="4"].is-wire-selected') + assert plugged.count()==1,"Newly plugged route must become selected" + new_hit=page.locator('#wireLayer path.wire-interaction-hit[data-cable-key="1-4"].is-wire-selected') + assert new_hit.count()==1 and new_hit.get_attribute("data-edge-id")!=initial_edge + assert page.locator('#wireLayer path.wire-outgoing-line[data-from="1"][data-to="3"].is-wire-selected').count()==0 page.evaluate("window.__v60Observer.disconnect()") @@ -190,6 +275,7 @@ def run(): errs=[] page.on("pageerror",lambda error:errs.append(str(error))) exercise(page,width,height) + test_pan(page) if width==1680:test_wire(page) if width in (640,1680): page.screenshot(path=f"arsonmix-v60-fader-wire-{width}.png",full_page=False) @@ -197,7 +283,7 @@ def run(): page.close() finally: browser.close() - print("PASS V60 Chromium: taller source/Master, unity detent, fast full-span WIRE, no selected halo") + print("PASS V61 Chromium: physical fader, PAN hysteresis, IN-to-OUT whip, quiet selected jacket and auto-selected drag/plug") if __name__=="__main__": diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 6c3971b62..dd21d79ef 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -873,12 +873,12 @@ function previewNativePan(t,el,event){ let value=Math.max(-100,Math.min(100,Number(el.value))); if(!Number.isFinite(value))return null; - // Identical center latch to the approved Pages mixer: capture at 7, - // hold until 12, snap on release. No fake demo-model DSP mutation. + // Same V61 center hysteresis as the canonical Pages UI: capture at + // ±14, hold to ±22, settle within ±18; never fake native DSP state. const keyboard=el.dataset.panKeyboard==="true"; const bypass=!!event.altKey||el.dataset.panAltPointer==="true"; const latched=el.dataset.panDetent==="true"; - const width=event.type==="change"?12:latched?12:7; + const width=event.type==="change"?18:latched?22:14; if(!keyboard&&!bypass&&Math.abs(value)<=width){value=0;el.value="0";} el.dataset.panDetent=String(!keyboard&&value===0&&!bypass); if(event.type==="change")delete el.dataset.panKeyboard;