how to translate operation actors on plane actor

hi there,

I want to move the actor on a plane I created on scene with the mouse, that is translate.
I developed this in the code below, but when I select the actor and start the movement, the mouse and the actor cannot be in the same position. I can say more detailed as follows.

        camera = renderer.GetActiveCamera()
        view_focus = camera.GetFocalPoint()

        temp_out = [0, 0, 0]
        compute_world2display(renderer, view_focus[0], view_focus[1], view_focus[2], temp_out)
        focal_depth = temp_out[2]

        first_pick_point = [0, 0, 0, 0]
        last_pick_point = [0, 0, 0, 0]
        x, y = interactor.GetEventPosition()
        x_, y_ = interactor.GetLastEventPosition()
        compute_display2world(renderer, x, y, focal_depth, first_pick_point)
        compute_display2world(renderer, x_, y_, focal_depth, last_pick_point)

        start_position_3d = np.array(first_pick_point[:3])
        end_position_3d = np.array(last_pick_point[:3])

        delta = np.array(start_position_3d) - end_position_3d
        view_normal = np.array(renderer.GetActiveCamera().GetViewPlaneNormal())
        delta_inplane = delta - view_normal * np.dot(delta, view_normal)
        delta_inplane[2] = 0

        for actor in selected_actors:
            actor_transform = actor.GetUserTransform()
            if not actor_transform:
                actor_transform = vtkTransform()
            actor_transform.Translate(delta_inplane)
            actor.SetUserTransform(actor_transform)

When I click on the actor with the mouse and move it to the top right, the actor stays behind and the mouse stays ahead. There is no exact proportion.
Since I wanted to do this on x and y axis, I set z equal to 0.

I looked at previous threads and github. I didn’t see a clear solution.

Hello,

I fear I didn’t understand this. If you select an actor, then I suppose the mouse pointer is within the actor’s boundaries in screen coordinates.

Isn’t this the expected behavior? I mean, when I use Windows the mouse pointer is always on top anything else.

regards,

PC