BsHandleSlider.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsVector2I.h"
  4. #include "BsMatrix4.h"
  5. #include "BsQuaternion.h"
  6. namespace BansheeEngine
  7. {
  8. class BS_ED_EXPORT HandleSlider
  9. {
  10. public:
  11. enum class State
  12. {
  13. Inactive,
  14. Active,
  15. Hover
  16. };
  17. HandleSlider(bool fixedScale, float snapValue);
  18. virtual ~HandleSlider() { }
  19. State getState() const { return mState; }
  20. bool getFixedScale() const { return mFixedScale; }
  21. float getSnapValue() const { return mSnapValue; }
  22. void setPosition(const Vector3& position);
  23. void setRotation(const Quaternion& rotation);
  24. void setScale(const Vector3& scale);
  25. const Vector3& getPosition() const { return mPosition; }
  26. const Quaternion& getRotation() const { return mRotation; }
  27. const Vector3& getScale() const { return mScale; }
  28. virtual const Matrix4& getTransform() const { return mTransform; }
  29. protected:
  30. friend class HandleManager;
  31. void setInactive() { mState = State::Inactive; }
  32. void setActive(const Vector2I& pointerPos) { mState = State::Active; mLastPointerPos = pointerPos; }
  33. void setHover() { mState = State::Hover; }
  34. void registerDrag(const Vector2I& pointerPos);
  35. bool mFixedScale;
  36. float mSnapValue;
  37. Vector3 mPosition;
  38. Quaternion mRotation;
  39. Vector3 mScale;
  40. Matrix4 mTransform;
  41. Vector2I mLastPointerPos;
  42. Vector2I mCurPointerPos;
  43. State mState;
  44. };
  45. }