ActionManager / PointerDragBehavior as a resource


I’m currently wondering about action managers and pointer drag behaviors as resources (I hope I did not miss it in the documentation). We currently use several instances of action managers and pointer drag behaviors at the same time, e. g. when a new complex object is added, a new action manager and a new pointer drag behavior are created as well.

Since PointerDragBehavior creates a drag plane, I assume that it consumes resources. I checked the code - the drag plane is disposed when the scene is disposed. Do we pollute the memory if we create a lot of those behaviors? I did not find a dispose method on the behavior. Should I reuse them, can I apply the same behavior / action manager to multiple meshes at the same time? Or is there a method to dispose them when they are not used anymore?

Kind regards

pinging @Cedric

ActionManager should be fine and not having one per mesh can be difficult.

Regarding the PointerDragBehavior, as long as you detach the unneeded ones they should not have much cost.

Thank you for your quick answer!

I checked the code in the pointer drag behavior - the dragPlane is not disposed during detach, only some observers are removed. So you think the remaining drag planes are not an issue?

so it will get disposed only when the main scene has been disposed. I do not think it consumes much memory but still I wonder if we could improve it, @Cedric ?

RAII, it should be disposed when detached. Let me do some tests …

1 Like

I did a PR


Thank you all for your quick feedback!

1 Like