| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #pragma once
- #include "BsEditorPrerequisites.h"
- namespace BansheeEngine
- {
- /** Controls all instantiated HandleSlider%s. */
- class BS_ED_EXPORT HandleSliderManager
- {
- /** Contains active/hover sliders for each camera. */
- struct StatePerCamera
- {
- HandleSlider* activeSlider = nullptr;
- HandleSlider* hoverSlider = nullptr;
- };
- public:
- /**
- * Updates all underlying sliders, changing their state and dragging them depending on their state and pointer
- * movement.
- *
- * @param[in] camera Camera through which we're interacting with sliders.
- * @param[in] inputPos Position of the pointer.
- * @param[in] inputDelta Movement of the pointer since last frame.
- */
- void update(const CameraPtr& camera, const Vector2I& inputPos, const Vector2I& inputDelta);
- /**
- * Attempts to select (activate) a slider at the specified position.
- *
- * @param[in] camera Camera through which we're interacting with sliders.
- * @param[in] inputPos Position of the pointer.
- */
- void trySelect(const CameraPtr& camera, const Vector2I& inputPos);
- /** Clears the active slider (deactivates it) for the specified camera. */
- void clearSelection(const CameraPtr& camera);
- /** Checks is any slider active for the specified camera. */
- bool isSliderActive(const CameraPtr& camera) const;
- /** Registers a new instantiated slider. */
- void _registerSlider(HandleSlider* slider);
- /** Unregisters a previously instantiated slider. */
- void _unregisterSlider(HandleSlider* slider);
- private:
- /**
- * Attempts to find slider at the specified position.
- *
- * @param[in] camera Camera through which we're interacting with sliders.
- * @param[in] inputPos Position of the pointer.
- * @return Slider if we're intersecting with one, or null otherwise.
- */
- HandleSlider* findUnderCursor(const CameraPtr& camera, const Vector2I& inputPos) const;
- UnorderedMap<UINT64, StatePerCamera> mStates;
- UnorderedSet<HandleSlider*> mSliders;
- };
- }
|