This is a corollary of the formula relating degree and contact orders of marks and nodes on a log stable curve together with the balancing condition.
Corollary
Let \((C/W, \mathbf p, f)\) be a log stable curve with \(W\) a log point. Let \(\mathcal L_s\) denote the line bundle associated to a global section \(s\in \Gamma(X, \overline{\mathcal M}_X)\) and let \(u_{p_i}\) denote the contact order of \(p_i\). Then
\begin{align*} \deg \underline f^*\mathcal L_s = -\sum_{i=1}^n\langle u_{p_i}, s\rangle. \end{align*}The point is that, when we don’t restrict to a single component of \(C\), the contact orders of the nodes cancel and we only get the contribution of the marks.