     if (d < closestDistance) {
              closestDistance = d;
              closestPort = p;
              closestPortPt = ppt;
              nodePort = port;
            }
          }
        }

        // found something to snap to!
        if (closestPort !== null) {
          // move the node so that the compatible ports coincide
          const noderelpt = nodePort.getDocumentPoint(go.Spot.Center).subtract(node.location);
          const snappt = closestPortPt.copy().subtract(noderelpt);
         