| 3046 | } |
| 3047 | |
| 3048 | void CEditor::RenderLayers(CUIRect LayersBox) |
| 3049 | { |
| 3050 | const float RowHeight = 12.0f; |
| 3051 | char aBuf[64]; |
| 3052 | |
| 3053 | CUIRect UnscrolledLayersBox = LayersBox; |
| 3054 | |
| 3055 | static CScrollRegion s_ScrollRegion; |
| 3056 | vec2 ScrollOffset(0.0f, 0.0f); |
| 3057 | CScrollRegionParams ScrollParams; |
| 3058 | ScrollParams.m_ScrollbarWidth = 10.0f; |
| 3059 | ScrollParams.m_ScrollbarMargin = 3.0f; |
| 3060 | ScrollParams.m_ScrollUnit = RowHeight * 5.0f; |
| 3061 | s_ScrollRegion.Begin(&LayersBox, &ScrollOffset, &ScrollParams); |
| 3062 | LayersBox.y += ScrollOffset.y; |
| 3063 | |
| 3064 | enum |
| 3065 | { |
| 3066 | OP_NONE = 0, |
| 3067 | OP_CLICK, |
| 3068 | OP_LAYER_DRAG, |
| 3069 | OP_GROUP_DRAG |
| 3070 | }; |
| 3071 | static int s_Operation = OP_NONE; |
| 3072 | static int s_PreviousOperation = OP_NONE; |
| 3073 | static const void *s_pDraggedButton = nullptr; |
| 3074 | static float s_InitialMouseY = 0; |
| 3075 | static float s_InitialCutHeight = 0; |
| 3076 | constexpr float MinDragDistance = 5.0f; |
| 3077 | int GroupAfterDraggedLayer = -1; |
| 3078 | int LayerAfterDraggedLayer = -1; |
| 3079 | bool DraggedPositionFound = false; |
| 3080 | bool MoveLayers = false; |
| 3081 | bool MoveGroup = false; |
| 3082 | bool StartDragLayer = false; |
| 3083 | bool StartDragGroup = false; |
| 3084 | std::vector<int> vButtonsPerGroup; |
| 3085 | |
| 3086 | auto SetOperation = [](int Operation) { |
| 3087 | if(Operation != s_Operation) |
| 3088 | { |
| 3089 | s_PreviousOperation = s_Operation; |
| 3090 | s_Operation = Operation; |
| 3091 | if(Operation == OP_NONE) |
| 3092 | { |
| 3093 | s_pDraggedButton = nullptr; |
| 3094 | } |
| 3095 | } |
| 3096 | }; |
| 3097 | |
| 3098 | vButtonsPerGroup.reserve(Map()->m_vpGroups.size()); |
| 3099 | for(const std::shared_ptr<CLayerGroup> &pGroup : Map()->m_vpGroups) |
| 3100 | { |
| 3101 | vButtonsPerGroup.push_back(pGroup->m_vpLayers.size() + 1); |
| 3102 | } |
| 3103 | |
| 3104 | if(s_pDraggedButton != nullptr && Ui()->ActiveItem() != s_pDraggedButton) |
| 3105 | { |
nothing calls this directly
no test coverage detected