Ping dots fly between chassis centres instead of along the cable, and a dragged device leaves its cables behind #1228

Closed
opened 2026-11-09 16:12:53 +00:00 by jaylouisw · 0 comments
Owner

What happens

Press Ping between two devices and a dot is animated for every frame the simulator reports. The dot
does not travel along the cable. It leaves the centre of the source chassis and arrives at the
centre of the destination, cutting across whatever happens to be in between, while the cable itself
is drawn socket-to-socket somewhere else.

Steps to reproduce

  1. Add a switch and a PC, cable ether1 → eth0 with 1000BASE-T.
  2. Give them addresses in the same subnet, ping the PC from the switch.
  3. Watch the dot: it starts inside the switch body and ends inside the PC body, not at the two sockets.
  4. Now drag either device 300 px away, and ping again. The dot flies to where the new centre is
    while the cable is still drawn where the box used to be — so it follows neither.

Why

web/canvas.js:

  • deviceCenter(id) returns layout[id] + size/2 — the middle of the chassis.
  • animateEvents() tweens deviceCenter(from) → deviceCenter(to).

The frame events already carry the ports (engine/simulator.js emits
{ type: 'frame', from, fromIface, to, toIface, frame }), and the canvas already knows where every
socket is in world coordinates (portWorld(deviceId, iface), built by computeGeo() during render).
The animation simply does not use either.

Two related defects in the same area:

  • A completed drag does not redraw. The pointermove handler translates the device <g> live, and
    pointerup calls on.move(...), which persists the layout — but nothing calls render(). The
    cables (and the portPos table the animation and hit-testing read) keep the pre-drag coordinates
    until some unrelated event triggers a redraw.
  • deviceCenter() invents a position for a device with no layout entry: { x: 100, y: 100 }. That
    is a real point in world coordinates, so the dot flies to the top-left corner of the grid rather than
    failing visibly.

Expected

  • The dot travels from the source socket to the destination socket — i.e. along the drawn cable, which
    is a straight line between those two points.
  • After dragging a device, the cables follow it (during the drag, ideally, and at least on release),
    and a ping that follows the drag uses the new positions.
  • A missing socket position is skipped with a warning, not replaced by (100, 100).

Not the same as

#66 (cable hit band over sockets) and #61 (ghost link stealing clicks) — those are hit-testing; this is
the animation path and the redraw after a move.

## What happens Press **Ping** between two devices and a dot is animated for every frame the simulator reports. The dot does not travel along the cable. It leaves the **centre** of the source chassis and arrives at the **centre** of the destination, cutting across whatever happens to be in between, while the cable itself is drawn socket-to-socket somewhere else. ## Steps to reproduce 1. Add a switch and a PC, cable `ether1` → `eth0` with 1000BASE-T. 2. Give them addresses in the same subnet, ping the PC from the switch. 3. Watch the dot: it starts inside the switch body and ends inside the PC body, not at the two sockets. 4. Now drag either device 300 px away, and ping again. The dot flies to where the *new* centre is while the cable is still drawn where the box used to be — so it follows neither. ## Why `web/canvas.js`: * `deviceCenter(id)` returns `layout[id] + size/2` — the middle of the chassis. * `animateEvents()` tweens `deviceCenter(from)` → `deviceCenter(to)`. The frame events already carry the ports (`engine/simulator.js` emits `{ type: 'frame', from, fromIface, to, toIface, frame }`), and the canvas already knows where every socket is in world coordinates (`portWorld(deviceId, iface)`, built by `computeGeo()` during `render`). The animation simply does not use either. Two related defects in the same area: * **A completed drag does not redraw.** The `pointermove` handler translates the device `<g>` live, and `pointerup` calls `on.move(...)`, which persists the layout — but nothing calls `render()`. The cables (and the `portPos` table the animation and hit-testing read) keep the pre-drag coordinates until some unrelated event triggers a redraw. * **`deviceCenter()` invents a position** for a device with no `layout` entry: `{ x: 100, y: 100 }`. That is a real point in world coordinates, so the dot flies to the top-left corner of the grid rather than failing visibly. ## Expected * The dot travels from the source socket to the destination socket — i.e. along the drawn cable, which is a straight line between those two points. * After dragging a device, the cables follow it (during the drag, ideally, and at least on release), and a ping that follows the drag uses the new positions. * A missing socket position is skipped with a warning, not replaced by (100, 100). ## Not the same as #66 (cable hit band over sockets) and #61 (ghost link stealing clicks) — those are hit-testing; this is the animation path and the redraw after a move.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge#1228
No description provided.