[Bug] Issue with the SetAsMovingSource Method in DragOffView

WeiYiHua

Member
Hello, it appears that there is an issue with the SetAsMovingSource method in DragOffView. The 'movingSource' parameter of SetAsMovingSource doesn't seem to be utilized within this method. This means that the DragOffView won't revert to its original state at the end of the move. This has caused some problems in my project.

A possible correct approach to modify the code could be:
Code:
/// <summary>
/// Set the view as the source of a movement.
/// </summary>
/// <param name="movingSource">started moving or stopped?</param>
public void SetAsMovingSource(bool movingSource)
{
    ActivateGameObjects(m_ActivateOnDragSource, movingSource);
    ActivateGameObjects(m_DeactivateOnDragSource, !movingSource);
    EnableComponents(m_EnableOnDragSource, movingSource);
    EnableComponents(m_DisableOnDragSource, !movingSource);
   
    m_OnDragSource?.Invoke();
}
It seems that the m_OnDragSource might also need modification.
 
That's odd... I haven't touched that part of the code in awhile. And I haven't experienced any issues in the past.
Can you explain what steps made you realized something wasn't working properly?
 
Here's the method in UIS1.2.17:
Code:
/// <summary>
/// Set the view as the source of a movement.
/// </summary>
/// <param name="movingSource">started moving or stopped?</param>
public void SetAsMovingSource(bool movingSource)
{
    ActivateGameObjects(m_ActivateOnDragSource, true);
    ActivateGameObjects(m_DeactivateOnDragSource, false);
    EnableComponents(m_EnableOnDragSource, true);
    EnableComponents(m_DisableOnDragSource, false);
    
    m_OnDragSource?.Invoke();
}
 
When you control a GameObject on multiple ItemViewModule at the same time, under normal circumstances, you should open and close the GameObject in StartMove of ItemViewSlotCursorManager, and restore the GameObject in RemoveItemView. But now it only turns on and off the GameObject.
 
Top