Computing coefficienct function integral over material interface elementwise

There is a coefficient function I want to integrate over the material interface defined in the mesh. I want to do this elementwise, such that for each element with an edge on the interface, it recieves half of the integral over that edge. However, I am having trouble creating this behaviour.
Here is an example of my mesh with material interface

import ngsolve as ng
from ngsolve.webgui import Draw
import netgen.geom2d as geom2d
from netgen.occ import *

def square_mesh(maxh):
    """square mesh from (-1,-1) to (1,1) with material interface at x=0"""
    rect1 = MoveTo(-1,-1).Rectangle(1,2).Face()
    rect2 = MoveTo(0,-1).Rectangle(1,2).Face()
    rect1.faces.name = "left_mat"
    rect1.edges.name = "border"
    rect2.faces.name = "right_mat"
    rect2.edges.name = "border"
    rect1.edges.Max(X).name  = "interface"
    rect2.edges.Min(X).name = "interface"
    shape = Glue([rect1,rect2])
    geo = OCCGeometry(shape, dim=2)
    mesh = ng.Mesh(geo.GenerateMesh(maxh=maxh))
    return mesh

Here’s an example of the integral I tried to do

domain = square_mesh(1.0)
ng.Integrate(ng.CoefficientFunction(1)*ng.ds("interface"),domain,element_wise=True)

The integral should equal 2. Since there are 4 adjacent elements, I expect there to be 4 elements with value 0.25 (all other elements should have value 0), however I instead only get 2 elements with value 1.

Any help in creating the desired behaviour is greatly appreciated.