Phone UI and touch precision overhaul, proxy fixes, Orbital Uplink, four new maps

Phone panels (reviewed + QA'd, matrix of 22 layouts with real taps/bounding boxes):
- selected-tower action bar over the board (Upgrade/Sell/Target/close), info panel
  updated in place so taps are never lost, scrollable palette for 7+ towers,
  overlays with pinned footers (Help "Got it", Play solo, Join always visible),
  tappable room chip to invite, reduced-motion/contrast/forced-colors fixes,
  paused state, partner cursor labels, bigger level pips and owner flags
- touch input rewritten around "pointerdown commits nothing": pinch never builds,
  10px tap slop, palm-proof pinch, long-press pings with any tool armed, nudge
  arrows for precise placement, hotkey repeat guard, proportional wheel zoom
- new e2e: select/sell, info-panel stability, UI states, touch precision;
  camera unit tests

Proxy/server (reproduced against real nginx 1.26 with NPM v2.16 config):
- Origin check works when the proxy drops a non-default port, TRUSTED_PROXIES for
  proxies on global IPv6/CGNAT addresses, service worker no longer serves nginx's
  502 page, DEPLOY.md corrected (NPM default read timeout is 90 s, Advanced-tab
  limits, path-prefix, cookie size, per-IP cap behaviour)

Content:
- Orbital Uplink: 4-level endgame tower (450 + 500/800/1200 credits): piercing
  armour-ignoring beam, blast and lingering slow, ground+air, range 11-14;
  glyph, beam effect, sound, help text, unit tests
- Maps: The Canyon, Archipelago, Fortress, Pinwheel (7 maps total)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8
This commit is contained in:
Claude 2026-10-10 18:03:24 +00:00
parent dad0382e10
commit a5bd09d505
22 changed files with 2423 additions and 405 deletions

View file

@ -10,6 +10,7 @@
const TAU = Math.PI * 2;
const SLOT_COLORS = ['#4de3ff', '#ffd24d'];
const BG = '#050810', BOARD = '#09101f';
const MARGIN = 10; // world px kept free on every side of the board so the gateway / server rings are never cut off
const clamp = (v, a, b) => Math.min(b, Math.max(a, v));
const lerpAngle = (a, b, k) => { let d = ((b - a + Math.PI * 3) % TAU) - Math.PI; return a + d * k; };
@ -55,6 +56,7 @@
ctx.restore(); return;
}
ctx.fillStyle = '#0c1426'; rr(ctx, -h, -h, h * 2, h * 2, S * 0.12); ctx.fill();
if (level >= 2) { ctx.fillStyle = rgba(col, level >= 3 ? 0.3 : 0.16); ctx.fill(); } // upgraded towers are tinted (level 3 clearly)
ctx.lineWidth = S * (level >= 3 ? 0.075 : 0.05); ctx.strokeStyle = col; ctx.stroke();
ctx.lineCap = 'round'; ctx.lineJoin = 'round';
switch (type) {
@ -100,11 +102,29 @@
ctx.lineTo(-S * 0.07, S * 0.27); ctx.lineTo(S * 0.15, -S * 0.07); ctx.lineTo(S * 0.02, -S * 0.07); ctx.lineTo(S * 0.11, -S * 0.26);
ctx.closePath(); ctx.fill();
break;
case 'uplink': {
// satellite dish with a feed horn and two pulsing signal arcs
const pulse = (t * 0.8) % 1;
ctx.lineWidth = S * 0.07; ctx.strokeStyle = col;
ctx.beginPath(); ctx.arc(0, S * 0.07, S * 0.23, Math.PI * 0.12, Math.PI * 0.88); ctx.stroke();
ctx.lineWidth = S * 0.045;
ctx.beginPath(); ctx.moveTo(0, S * 0.07); ctx.lineTo(0, -S * 0.15); ctx.stroke();
ctx.fillStyle = col; ctx.beginPath(); ctx.arc(0, -S * 0.17, S * 0.05, 0, TAU); ctx.fill();
for (let i = 0; i < 2; i++) {
const k = (pulse + i * 0.5) % 1;
ctx.strokeStyle = rgba(col, 1 - k); ctx.lineWidth = S * 0.035;
ctx.beginPath(); ctx.arc(0, -S * 0.17, S * (0.1 + 0.2 * k), -Math.PI * 0.85, -Math.PI * 0.15); ctx.stroke();
}
break;
}
default: break;
}
// level pips
ctx.fillStyle = '#ffffff';
for (let i = 0; i < level; i++) { ctx.beginPath(); ctx.arc((i - (level - 1) / 2) * S * 0.13, h - S * 0.08, S * 0.035, 0, TAU); ctx.fill(); }
// level pips: big enough to read at 14 px cells, with a dark halo so they show on any tile colour
for (let i = 0; i < level; i++) {
const px = (i - (level - 1) / 2) * S * 0.25, py = h - S * 0.11;
ctx.fillStyle = '#04101a'; ctx.beginPath(); ctx.arc(px, py, S * 0.125, 0, TAU); ctx.fill();
ctx.fillStyle = '#ffffff'; ctx.beginPath(); ctx.arc(px, py, S * 0.085, 0, TAU); ctx.fill();
}
ctx.restore();
}
@ -229,7 +249,7 @@
_layout() {
const b = this.board; if (!b) return;
const d = this._dims(), pad = 4;
this.fit = Math.min((this.W - pad * 2) / d.w, (this.H - pad * 2) / d.h);
this.fit = Math.min((this.W - pad * 2) / (d.w + MARGIN * 2), (this.H - pad * 2) / (d.h + MARGIN * 2));
this.scale = this.fit * this.cam.zoom;
const sw = d.w * this.scale, sh = d.h * this.scale;
const mx = sw > this.W ? (sw - this.W) / 2 + 24 : 0, my = sh > this.H ? (sh - this.H) / 2 + 24 : 0;
@ -261,6 +281,9 @@
return { x: Math.floor(fx), y: Math.floor(fy), fx, fy };
}
cellToScreen(cx, cy) { return this._w2s((cx + 0.5) * C, (cy + 0.5) * C); }
// The cell one step away in a SCREEN direction (dx, dy each -1, 0 or 1). The board is drawn turned 90 degrees on tall screens,
// so screen right is not world +x there: this is what the touch nudge buttons use.
stepCell(cx, cy, dx, dy) { return this.rot ? { x: cx + dy, y: cy - dx } : { x: cx + dx, y: cy + dy }; }
cellSizePx() { return C * this.scale; }
// ---------------------------------------------------------------- effects
@ -296,6 +319,17 @@
else if (e.k === 'filter') this._burst(e.x * C + Math.cos(e.a) * 14, e.y * C + Math.sin(e.a) * 14, '#35e0a1', 1, 30, 0.12);
else if (e.k === 'mortar') this._burst(e.x * C + Math.cos(e.a) * 16, e.y * C + Math.sin(e.a) * 16, '#d4f04a', 3, 40, 0.25);
break;
case 'beam': {
const x1 = e.x * C, y1 = e.y * C, x2 = e.tx * C, y2 = e.ty * C, wpx = (e.w || 0.5) * C;
this.lines.push({ pts: [[x1, y1], [x2, y2]], col: 'rgba(255,226,122,.35)', w: wpx * 2.6, life: 0.42, max: 0.42, jit: 0 });
this.lines.push({ pts: [[x1, y1], [x2, y2]], col: '#ffe27a', w: wpx * 1.1, life: 0.34, max: 0.34, jit: 0 });
this.lines.push({ pts: [[x1, y1], [x2, y2]], col: '#ffffff', w: wpx * 0.45, life: 0.26, max: 0.26, jit: 0 });
this._ring(e.bx * C, e.by * C, 6, (e.br || 1.3) * C, '#ffe27a', 0.45, 4);
this._burst(e.bx * C, e.by * C, '#ffe27a', 10, 130, 0.45);
this._ring(x1, y1, 4, 30, '#ffffff', 0.25, 3);
this.shake = Math.min(2, this.shake + 0.35);
break;
}
case 'arc': this.lines.push({ pts: e.pts.map((p) => [p[0] * C, p[1] * C]), col: '#ff7ad9', w: 2.4, life: 0.18, max: 0.18, jit: 5 }); break;
case 'place': { const d = TD.TOWERS[e.type]; this._ring((e.x + 0.5) * C, (e.y + 0.5) * C, 6, 34, d ? d.color : '#fff', 0.35, 2.5); this._burst((e.x + 0.5) * C, (e.y + 0.5) * C, d ? d.color : '#fff', 5, 60, 0.35); break; }
case 'sell': this._burst((e.x + 0.5) * C, (e.y + 0.5) * C, '#9db4d8', 6, 70, 0.35); break;
@ -388,9 +422,11 @@
if (tg) { ang = lerpAngle(ang, Math.atan2(tg.y - (tw.y + 0.5), tg.x - (tw.x + 0.5)), 0.35); this.aim.set(tw.id, ang); }
const cx = (tw.x + 0.5) * C, cy = (tw.y + 0.5) * C;
drawGlyph(ctx, tw.type, tw.level, cx, cy, C, ang, t, 1, rot);
if (coop && tw.type !== 'wall') {
ctx.fillStyle = SLOT_COLORS[tw.owner] || '#fff';
ctx.beginPath(); ctx.moveTo(cx - C * 0.43, cy - C * 0.43); ctx.lineTo(cx - C * 0.43 + 8, cy - C * 0.43); ctx.lineTo(cx - C * 0.43, cy - C * 0.43 + 8); ctx.closePath(); ctx.fill();
if (coop && tw.type !== 'wall') { // owner corner flag: at least ~5 CSS px, dark outline so it shows on a tile of the same colour
const k = Math.max(12, 5.5 / sc), x0 = cx - C * 0.46, y0 = cy - C * 0.46;
ctx.beginPath(); ctx.moveTo(x0, y0); ctx.lineTo(x0 + k, y0); ctx.lineTo(x0, y0 + k); ctx.closePath();
ctx.fillStyle = SLOT_COLORS[tw.owner] || '#fff'; ctx.fill();
ctx.lineWidth = 1.5 / sc; ctx.strokeStyle = '#04101a'; ctx.stroke();
}
}
if (this.aim.size > towers.length + 40) { const live = new Set(towers.map((x) => x.id)); for (const k of this.aim.keys()) if (!live.has(k)) this.aim.delete(k); }
@ -445,18 +481,12 @@
}
// partner cursors and pings
ctx.font = '600 ' + (11 / sc) + 'px system-ui, sans-serif'; ctx.textBaseline = 'middle';
const labels = []; // the cell frame is drawn on the board, the name label later in screen space (clamped to the stage)
for (const cu of view.cursors || []) {
const col = SLOT_COLORS[cu.slot] || '#fff', gx = Math.floor(cu.x), gy = Math.floor(cu.y);
ctx.strokeStyle = col; ctx.lineWidth = 2; ctx.strokeRect(gx * C + 1, gy * C + 1, C - 2, C - 2);
const nm = (ui.names && ui.names[cu.slot]) || 'Partner';
const tw = ctx.measureText(nm).width + 10 / sc;
ctx.save(); ctx.translate((gx + 0.5) * C, (gy + 0.5) * C); if (rot) ctx.rotate(-rot);
ctx.fillStyle = col; ctx.fillRect(-tw / 2, -C / 2 - 17 / sc, tw, 15 / sc);
ctx.fillStyle = '#04101a'; ctx.textAlign = 'center'; ctx.fillText(nm, 0, -C / 2 - 9.5 / sc);
ctx.restore();
labels.push({ nm: (ui.names && ui.names[cu.slot]) || 'Partner', col, gx, gy });
}
ctx.textAlign = 'start';
for (let i = this.marks.length - 1; i >= 0; i--) {
const m = this.marks[i]; m.life -= dt;
if (m.life <= 0) { this.marks.splice(i, 1); continue; }
@ -469,6 +499,7 @@
ctx.globalAlpha = 1;
ctx.fillStyle = col; ctx.beginPath(); ctx.arc((m.x + 0.5) * C, (m.y + 0.5) * C, 5, 0, TAU); ctx.fill();
}
if (labels.length) this._cursorLabels(ctx, labels);
}
_rangeRing(ctx, cx, cy, r, col) {
@ -589,6 +620,22 @@
ctx.globalAlpha = 1; ctx.textAlign = 'start';
}
}
// partner name labels: screen space, kept inside the stage, flipped below the cell when there is no room above it
_cursorLabels(ctx, labels) {
ctx.setTransform(this.dpr, 0, 0, this.dpr, 0, 0);
ctx.font = '600 11px system-ui, sans-serif'; ctx.textBaseline = 'middle'; ctx.textAlign = 'center';
const half = C * this.scale / 2;
for (const l of labels) {
const p = this.cellToScreen(l.gx, l.gy), w = ctx.measureText(l.nm).width + 10;
const x = clamp(p.x - w / 2, 2, Math.max(2, this.W - 2 - w));
let y = p.y - half - 17; if (y < 2) y = p.y + half + 2;
y = clamp(y, 2, Math.max(2, this.H - 17));
ctx.fillStyle = l.col; ctx.fillRect(x, y, w, 15);
ctx.fillStyle = '#04101a'; ctx.fillText(l.nm, x + w / 2, y + 7.5);
}
ctx.textAlign = 'start';
}
}
// Draw a tower icon into a small canvas (palette buttons, info panel)
@ -606,4 +653,5 @@
NW.drawGlyph = drawGlyph;
NW.SLOT_COLORS = SLOT_COLORS;
NW.CELL = C;
NW.BOARD_MARGIN = MARGIN;
})(typeof self !== 'undefined' ? self : this);