faradayfuture commited on
Commit
c2ac7dc
·
verified ·
1 Parent(s): 6f24fde

Tighter tactile panel: canvas shrinks to content, sidebar 340px; ep4 re-uploaded as a regular file

Browse files
ep0/viewer.html CHANGED
@@ -47,7 +47,7 @@ canvas{width:100%;display:block;cursor:pointer}
47
  .dl-cmd{background:#171b24;color:#c7ccd6;border:1px solid #232733;border-radius:6px;padding:7px 12px;font-size:12.5px;cursor:pointer;font-family:ui-monospace,monospace}
48
  .dl-cmd:hover{border-color:#3a4a6a}.dl:hover{text-decoration:underline}
49
 
50
- .layout{grid-template-columns:1fr 400px}
51
  .sidecol{display:flex;flex-direction:column;gap:14px;min-width:0}
52
  .sidecol > .panel:first-child{flex:1 1 auto;min-height:120px;overflow:auto}
53
  .tacpanel{flex:0 0 auto}
@@ -280,7 +280,7 @@ function drawTactile(i){
280
  cHand.width=HW*dpr; cHand.height=HH*dpr; ctx.setTransform(dpr,0,0,dpr,0,0); ctx.clearRect(0,0,HW,HH);
281
  const oy=(HH-BBOX.h*HSC)/2-BBOX.y*HSC;
282
  HANDS.forEach((hd,hi)=>{
283
- const ox=8+hi*(HW/2)-BBOX.x*HSC;
284
  ctx.save(); ctx.translate(ox,oy); ctx.scale(HSC,HSC);
285
  ctx.strokeStyle='#26313f'; ctx.lineWidth=1.1;
286
  for(const o of hd.lay.outline){ctx.save(); ctx.strokeStyle=o.palm?'#33475c':'#26313f';
@@ -422,10 +422,12 @@ function fitHand(){
422
  if(cap>60) spans.style.maxHeight=Math.floor(cap)+'px';
423
  }
424
  h=Math.min(300,Math.max(150,Math.floor(h)));
425
- var w=Math.max(280,Math.floor(tac.clientWidth-20));
426
- if(h===HH && w===HW) return;
427
- HH=h; HW=w; HSC=Math.min(HH/BBOX.h,(HW/2-8)/BBOX.w);
428
- cHand.style.height=HH+'px';
 
 
429
  drawTactile(_frame);
430
  }
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
 
47
  .dl-cmd{background:#171b24;color:#c7ccd6;border:1px solid #232733;border-radius:6px;padding:7px 12px;font-size:12.5px;cursor:pointer;font-family:ui-monospace,monospace}
48
  .dl-cmd:hover{border-color:#3a4a6a}.dl:hover{text-decoration:underline}
49
 
50
+ .layout{grid-template-columns:1fr 340px}
51
  .sidecol{display:flex;flex-direction:column;gap:14px;min-width:0}
52
  .sidecol > .panel:first-child{flex:1 1 auto;min-height:120px;overflow:auto}
53
  .tacpanel{flex:0 0 auto}
 
280
  cHand.width=HW*dpr; cHand.height=HH*dpr; ctx.setTransform(dpr,0,0,dpr,0,0); ctx.clearRect(0,0,HW,HH);
281
  const oy=(HH-BBOX.h*HSC)/2-BBOX.y*HSC;
282
  HANDS.forEach((hd,hi)=>{
283
+ const ox=8+hi*(HW/2-8+8)-BBOX.x*HSC;
284
  ctx.save(); ctx.translate(ox,oy); ctx.scale(HSC,HSC);
285
  ctx.strokeStyle='#26313f'; ctx.lineWidth=1.1;
286
  for(const o of hd.lay.outline){ctx.save(); ctx.strokeStyle=o.palm?'#33475c':'#26313f';
 
422
  if(cap>60) spans.style.maxHeight=Math.floor(cap)+'px';
423
  }
424
  h=Math.min(300,Math.max(150,Math.floor(h)));
425
+ var wAvail=Math.max(240,Math.floor(tac.clientWidth-16));
426
+ var sc=Math.min(h/BBOX.h,(wAvail/2-6)/BBOX.w); // 先定缩放
427
+ var w=Math.ceil(2*(BBOX.w*sc)+16), hh=Math.ceil(BBOX.h*sc)+2; // 再把画布收到内容大小
428
+ if(hh===HH && w===HW) return;
429
+ HH=hh; HW=w; HSC=sc;
430
+ cHand.style.height=HH+'px'; cHand.style.width=HW+'px'; cHand.style.margin='0 auto';
431
  drawTactile(_frame);
432
  }
433
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
ep1/viewer.html CHANGED
@@ -47,7 +47,7 @@ canvas{width:100%;display:block;cursor:pointer}
47
  .dl-cmd{background:#171b24;color:#c7ccd6;border:1px solid #232733;border-radius:6px;padding:7px 12px;font-size:12.5px;cursor:pointer;font-family:ui-monospace,monospace}
48
  .dl-cmd:hover{border-color:#3a4a6a}.dl:hover{text-decoration:underline}
49
 
50
- .layout{grid-template-columns:1fr 400px}
51
  .sidecol{display:flex;flex-direction:column;gap:14px;min-width:0}
52
  .sidecol > .panel:first-child{flex:1 1 auto;min-height:120px;overflow:auto}
53
  .tacpanel{flex:0 0 auto}
@@ -280,7 +280,7 @@ function drawTactile(i){
280
  cHand.width=HW*dpr; cHand.height=HH*dpr; ctx.setTransform(dpr,0,0,dpr,0,0); ctx.clearRect(0,0,HW,HH);
281
  const oy=(HH-BBOX.h*HSC)/2-BBOX.y*HSC;
282
  HANDS.forEach((hd,hi)=>{
283
- const ox=8+hi*(HW/2)-BBOX.x*HSC;
284
  ctx.save(); ctx.translate(ox,oy); ctx.scale(HSC,HSC);
285
  ctx.strokeStyle='#26313f'; ctx.lineWidth=1.1;
286
  for(const o of hd.lay.outline){ctx.save(); ctx.strokeStyle=o.palm?'#33475c':'#26313f';
@@ -422,10 +422,12 @@ function fitHand(){
422
  if(cap>60) spans.style.maxHeight=Math.floor(cap)+'px';
423
  }
424
  h=Math.min(300,Math.max(150,Math.floor(h)));
425
- var w=Math.max(280,Math.floor(tac.clientWidth-20));
426
- if(h===HH && w===HW) return;
427
- HH=h; HW=w; HSC=Math.min(HH/BBOX.h,(HW/2-8)/BBOX.w);
428
- cHand.style.height=HH+'px';
 
 
429
  drawTactile(_frame);
430
  }
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
 
47
  .dl-cmd{background:#171b24;color:#c7ccd6;border:1px solid #232733;border-radius:6px;padding:7px 12px;font-size:12.5px;cursor:pointer;font-family:ui-monospace,monospace}
48
  .dl-cmd:hover{border-color:#3a4a6a}.dl:hover{text-decoration:underline}
49
 
50
+ .layout{grid-template-columns:1fr 340px}
51
  .sidecol{display:flex;flex-direction:column;gap:14px;min-width:0}
52
  .sidecol > .panel:first-child{flex:1 1 auto;min-height:120px;overflow:auto}
53
  .tacpanel{flex:0 0 auto}
 
280
  cHand.width=HW*dpr; cHand.height=HH*dpr; ctx.setTransform(dpr,0,0,dpr,0,0); ctx.clearRect(0,0,HW,HH);
281
  const oy=(HH-BBOX.h*HSC)/2-BBOX.y*HSC;
282
  HANDS.forEach((hd,hi)=>{
283
+ const ox=8+hi*(HW/2-8+8)-BBOX.x*HSC;
284
  ctx.save(); ctx.translate(ox,oy); ctx.scale(HSC,HSC);
285
  ctx.strokeStyle='#26313f'; ctx.lineWidth=1.1;
286
  for(const o of hd.lay.outline){ctx.save(); ctx.strokeStyle=o.palm?'#33475c':'#26313f';
 
422
  if(cap>60) spans.style.maxHeight=Math.floor(cap)+'px';
423
  }
424
  h=Math.min(300,Math.max(150,Math.floor(h)));
425
+ var wAvail=Math.max(240,Math.floor(tac.clientWidth-16));
426
+ var sc=Math.min(h/BBOX.h,(wAvail/2-6)/BBOX.w); // 先定缩放
427
+ var w=Math.ceil(2*(BBOX.w*sc)+16), hh=Math.ceil(BBOX.h*sc)+2; // 再把画布收到内容大小
428
+ if(hh===HH && w===HW) return;
429
+ HH=hh; HW=w; HSC=sc;
430
+ cHand.style.height=HH+'px'; cHand.style.width=HW+'px'; cHand.style.margin='0 auto';
431
  drawTactile(_frame);
432
  }
433
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
ep2/viewer.html CHANGED
@@ -47,7 +47,7 @@ canvas{width:100%;display:block;cursor:pointer}
47
  .dl-cmd{background:#171b24;color:#c7ccd6;border:1px solid #232733;border-radius:6px;padding:7px 12px;font-size:12.5px;cursor:pointer;font-family:ui-monospace,monospace}
48
  .dl-cmd:hover{border-color:#3a4a6a}.dl:hover{text-decoration:underline}
49
 
50
- .layout{grid-template-columns:1fr 400px}
51
  .sidecol{display:flex;flex-direction:column;gap:14px;min-width:0}
52
  .sidecol > .panel:first-child{flex:1 1 auto;min-height:120px;overflow:auto}
53
  .tacpanel{flex:0 0 auto}
@@ -280,7 +280,7 @@ function drawTactile(i){
280
  cHand.width=HW*dpr; cHand.height=HH*dpr; ctx.setTransform(dpr,0,0,dpr,0,0); ctx.clearRect(0,0,HW,HH);
281
  const oy=(HH-BBOX.h*HSC)/2-BBOX.y*HSC;
282
  HANDS.forEach((hd,hi)=>{
283
- const ox=8+hi*(HW/2)-BBOX.x*HSC;
284
  ctx.save(); ctx.translate(ox,oy); ctx.scale(HSC,HSC);
285
  ctx.strokeStyle='#26313f'; ctx.lineWidth=1.1;
286
  for(const o of hd.lay.outline){ctx.save(); ctx.strokeStyle=o.palm?'#33475c':'#26313f';
@@ -422,10 +422,12 @@ function fitHand(){
422
  if(cap>60) spans.style.maxHeight=Math.floor(cap)+'px';
423
  }
424
  h=Math.min(300,Math.max(150,Math.floor(h)));
425
- var w=Math.max(280,Math.floor(tac.clientWidth-20));
426
- if(h===HH && w===HW) return;
427
- HH=h; HW=w; HSC=Math.min(HH/BBOX.h,(HW/2-8)/BBOX.w);
428
- cHand.style.height=HH+'px';
 
 
429
  drawTactile(_frame);
430
  }
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
 
47
  .dl-cmd{background:#171b24;color:#c7ccd6;border:1px solid #232733;border-radius:6px;padding:7px 12px;font-size:12.5px;cursor:pointer;font-family:ui-monospace,monospace}
48
  .dl-cmd:hover{border-color:#3a4a6a}.dl:hover{text-decoration:underline}
49
 
50
+ .layout{grid-template-columns:1fr 340px}
51
  .sidecol{display:flex;flex-direction:column;gap:14px;min-width:0}
52
  .sidecol > .panel:first-child{flex:1 1 auto;min-height:120px;overflow:auto}
53
  .tacpanel{flex:0 0 auto}
 
280
  cHand.width=HW*dpr; cHand.height=HH*dpr; ctx.setTransform(dpr,0,0,dpr,0,0); ctx.clearRect(0,0,HW,HH);
281
  const oy=(HH-BBOX.h*HSC)/2-BBOX.y*HSC;
282
  HANDS.forEach((hd,hi)=>{
283
+ const ox=8+hi*(HW/2-8+8)-BBOX.x*HSC;
284
  ctx.save(); ctx.translate(ox,oy); ctx.scale(HSC,HSC);
285
  ctx.strokeStyle='#26313f'; ctx.lineWidth=1.1;
286
  for(const o of hd.lay.outline){ctx.save(); ctx.strokeStyle=o.palm?'#33475c':'#26313f';
 
422
  if(cap>60) spans.style.maxHeight=Math.floor(cap)+'px';
423
  }
424
  h=Math.min(300,Math.max(150,Math.floor(h)));
425
+ var wAvail=Math.max(240,Math.floor(tac.clientWidth-16));
426
+ var sc=Math.min(h/BBOX.h,(wAvail/2-6)/BBOX.w); // 先定缩放
427
+ var w=Math.ceil(2*(BBOX.w*sc)+16), hh=Math.ceil(BBOX.h*sc)+2; // 再把画布收到内容大小
428
+ if(hh===HH && w===HW) return;
429
+ HH=hh; HW=w; HSC=sc;
430
+ cHand.style.height=HH+'px'; cHand.style.width=HW+'px'; cHand.style.margin='0 auto';
431
  drawTactile(_frame);
432
  }
433
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
ep3/viewer.html CHANGED
@@ -47,7 +47,7 @@ canvas{width:100%;display:block;cursor:pointer}
47
  .dl-cmd{background:#171b24;color:#c7ccd6;border:1px solid #232733;border-radius:6px;padding:7px 12px;font-size:12.5px;cursor:pointer;font-family:ui-monospace,monospace}
48
  .dl-cmd:hover{border-color:#3a4a6a}.dl:hover{text-decoration:underline}
49
 
50
- .layout{grid-template-columns:1fr 400px}
51
  .sidecol{display:flex;flex-direction:column;gap:14px;min-width:0}
52
  .sidecol > .panel:first-child{flex:1 1 auto;min-height:120px;overflow:auto}
53
  .tacpanel{flex:0 0 auto}
@@ -280,7 +280,7 @@ function drawTactile(i){
280
  cHand.width=HW*dpr; cHand.height=HH*dpr; ctx.setTransform(dpr,0,0,dpr,0,0); ctx.clearRect(0,0,HW,HH);
281
  const oy=(HH-BBOX.h*HSC)/2-BBOX.y*HSC;
282
  HANDS.forEach((hd,hi)=>{
283
- const ox=8+hi*(HW/2)-BBOX.x*HSC;
284
  ctx.save(); ctx.translate(ox,oy); ctx.scale(HSC,HSC);
285
  ctx.strokeStyle='#26313f'; ctx.lineWidth=1.1;
286
  for(const o of hd.lay.outline){ctx.save(); ctx.strokeStyle=o.palm?'#33475c':'#26313f';
@@ -422,10 +422,12 @@ function fitHand(){
422
  if(cap>60) spans.style.maxHeight=Math.floor(cap)+'px';
423
  }
424
  h=Math.min(300,Math.max(150,Math.floor(h)));
425
- var w=Math.max(280,Math.floor(tac.clientWidth-20));
426
- if(h===HH && w===HW) return;
427
- HH=h; HW=w; HSC=Math.min(HH/BBOX.h,(HW/2-8)/BBOX.w);
428
- cHand.style.height=HH+'px';
 
 
429
  drawTactile(_frame);
430
  }
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
 
47
  .dl-cmd{background:#171b24;color:#c7ccd6;border:1px solid #232733;border-radius:6px;padding:7px 12px;font-size:12.5px;cursor:pointer;font-family:ui-monospace,monospace}
48
  .dl-cmd:hover{border-color:#3a4a6a}.dl:hover{text-decoration:underline}
49
 
50
+ .layout{grid-template-columns:1fr 340px}
51
  .sidecol{display:flex;flex-direction:column;gap:14px;min-width:0}
52
  .sidecol > .panel:first-child{flex:1 1 auto;min-height:120px;overflow:auto}
53
  .tacpanel{flex:0 0 auto}
 
280
  cHand.width=HW*dpr; cHand.height=HH*dpr; ctx.setTransform(dpr,0,0,dpr,0,0); ctx.clearRect(0,0,HW,HH);
281
  const oy=(HH-BBOX.h*HSC)/2-BBOX.y*HSC;
282
  HANDS.forEach((hd,hi)=>{
283
+ const ox=8+hi*(HW/2-8+8)-BBOX.x*HSC;
284
  ctx.save(); ctx.translate(ox,oy); ctx.scale(HSC,HSC);
285
  ctx.strokeStyle='#26313f'; ctx.lineWidth=1.1;
286
  for(const o of hd.lay.outline){ctx.save(); ctx.strokeStyle=o.palm?'#33475c':'#26313f';
 
422
  if(cap>60) spans.style.maxHeight=Math.floor(cap)+'px';
423
  }
424
  h=Math.min(300,Math.max(150,Math.floor(h)));
425
+ var wAvail=Math.max(240,Math.floor(tac.clientWidth-16));
426
+ var sc=Math.min(h/BBOX.h,(wAvail/2-6)/BBOX.w); // 先定缩放
427
+ var w=Math.ceil(2*(BBOX.w*sc)+16), hh=Math.ceil(BBOX.h*sc)+2; // 再把画布收到内容大小
428
+ if(hh===HH && w===HW) return;
429
+ HH=hh; HW=w; HSC=sc;
430
+ cHand.style.height=HH+'px'; cHand.style.width=HW+'px'; cHand.style.margin='0 auto';
431
  drawTactile(_frame);
432
  }
433
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
ep4/viewer.html CHANGED
The diff for this file is too large to render. See raw diff
 
ep5/viewer.html CHANGED
@@ -47,7 +47,7 @@ canvas{width:100%;display:block;cursor:pointer}
47
  .dl-cmd{background:#171b24;color:#c7ccd6;border:1px solid #232733;border-radius:6px;padding:7px 12px;font-size:12.5px;cursor:pointer;font-family:ui-monospace,monospace}
48
  .dl-cmd:hover{border-color:#3a4a6a}.dl:hover{text-decoration:underline}
49
 
50
- .layout{grid-template-columns:1fr 400px}
51
  .sidecol{display:flex;flex-direction:column;gap:14px;min-width:0}
52
  .sidecol > .panel:first-child{flex:1 1 auto;min-height:120px;overflow:auto}
53
  .tacpanel{flex:0 0 auto}
@@ -280,7 +280,7 @@ function drawTactile(i){
280
  cHand.width=HW*dpr; cHand.height=HH*dpr; ctx.setTransform(dpr,0,0,dpr,0,0); ctx.clearRect(0,0,HW,HH);
281
  const oy=(HH-BBOX.h*HSC)/2-BBOX.y*HSC;
282
  HANDS.forEach((hd,hi)=>{
283
- const ox=8+hi*(HW/2)-BBOX.x*HSC;
284
  ctx.save(); ctx.translate(ox,oy); ctx.scale(HSC,HSC);
285
  ctx.strokeStyle='#26313f'; ctx.lineWidth=1.1;
286
  for(const o of hd.lay.outline){ctx.save(); ctx.strokeStyle=o.palm?'#33475c':'#26313f';
@@ -422,10 +422,12 @@ function fitHand(){
422
  if(cap>60) spans.style.maxHeight=Math.floor(cap)+'px';
423
  }
424
  h=Math.min(300,Math.max(150,Math.floor(h)));
425
- var w=Math.max(280,Math.floor(tac.clientWidth-20));
426
- if(h===HH && w===HW) return;
427
- HH=h; HW=w; HSC=Math.min(HH/BBOX.h,(HW/2-8)/BBOX.w);
428
- cHand.style.height=HH+'px';
 
 
429
  drawTactile(_frame);
430
  }
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
 
47
  .dl-cmd{background:#171b24;color:#c7ccd6;border:1px solid #232733;border-radius:6px;padding:7px 12px;font-size:12.5px;cursor:pointer;font-family:ui-monospace,monospace}
48
  .dl-cmd:hover{border-color:#3a4a6a}.dl:hover{text-decoration:underline}
49
 
50
+ .layout{grid-template-columns:1fr 340px}
51
  .sidecol{display:flex;flex-direction:column;gap:14px;min-width:0}
52
  .sidecol > .panel:first-child{flex:1 1 auto;min-height:120px;overflow:auto}
53
  .tacpanel{flex:0 0 auto}
 
280
  cHand.width=HW*dpr; cHand.height=HH*dpr; ctx.setTransform(dpr,0,0,dpr,0,0); ctx.clearRect(0,0,HW,HH);
281
  const oy=(HH-BBOX.h*HSC)/2-BBOX.y*HSC;
282
  HANDS.forEach((hd,hi)=>{
283
+ const ox=8+hi*(HW/2-8+8)-BBOX.x*HSC;
284
  ctx.save(); ctx.translate(ox,oy); ctx.scale(HSC,HSC);
285
  ctx.strokeStyle='#26313f'; ctx.lineWidth=1.1;
286
  for(const o of hd.lay.outline){ctx.save(); ctx.strokeStyle=o.palm?'#33475c':'#26313f';
 
422
  if(cap>60) spans.style.maxHeight=Math.floor(cap)+'px';
423
  }
424
  h=Math.min(300,Math.max(150,Math.floor(h)));
425
+ var wAvail=Math.max(240,Math.floor(tac.clientWidth-16));
426
+ var sc=Math.min(h/BBOX.h,(wAvail/2-6)/BBOX.w); // 先定缩放
427
+ var w=Math.ceil(2*(BBOX.w*sc)+16), hh=Math.ceil(BBOX.h*sc)+2; // 再把画布收到内容大小
428
+ if(hh===HH && w===HW) return;
429
+ HH=hh; HW=w; HSC=sc;
430
+ cHand.style.height=HH+'px'; cHand.style.width=HW+'px'; cHand.style.margin='0 auto';
431
  drawTactile(_frame);
432
  }
433
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});