I have an attempt to implement a custom Bounding box gizmo. It is the regular Bounding box gizmo except that the draggable area is not just a single point but the whole face of a box, which means that I can drag on any place on the face of the box to resize the box. The problem I found is related to the PointerDragBehavior class that:
- If the face of a box is larger than the size of _dragPlane, I will have a chance to not be able to initiate the drag since the point I pick wouldn’t be on the _dragPlane. This is leading to the 2nd problem.
- How this class handles the _activeDragButton state. If we accidentally start dragging with the draggable area outside the _dragPlane, the result of trying to pick the _dragPlane will be null which will cause the _activeDragButton not to set the value back to -1. And I wouldn’t be able to initiate the drag ever again due to the condition _activeDragButton === -1 that is checked every time when trying to start a drag. As shown in Video 1.
Video 1, the black plane is the _dragPlane which has a limited size of 10,000. As you can see, it’s not covering the whole face of the box and thus I can’t always initiate the drag. And moreover, after the drag failed once, I couldn’t start the drag ever again as stated in 2.
I would like to suggest making the _dragPlane becoming more customizable, at least to be able to change its size from the inherited class. As well as resetting the state of _activeDragButton to -1 if the picking in _startDrag failed. Moreover, I would like to request that if we can return the whole information of the pointer that triggers the event as well instead of just pointerId to be able to identify whether this is a touch event or the event from the mouse.
If this idea sounds good, I am ready to make a contribution to this right away.