Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Scene2D/Internals/FixedPointAligner.h @ 1972:9c0adcc8feec
refactoring to simplify OneGesturePointerTracker
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 28 Oct 2022 16:21:28 +0200 |
parents | 7053b8a0aaec |
children | b31e494e34c5 |
comparison
equal
deleted
inserted
replaced
1971:e5b31d55206d | 1972:9c0adcc8feec |
---|---|
20 * <http://www.gnu.org/licenses/>. | 20 * <http://www.gnu.org/licenses/>. |
21 **/ | 21 **/ |
22 | 22 |
23 #pragma once | 23 #pragma once |
24 | 24 |
25 #include "../../Scene2DViewport/PredeclaredTypes.h" | 25 #include "../../Scene2DViewport/ViewportController.h" |
26 #include "../../Scene2D/ScenePoint2D.h" | |
27 #include "../../Viewport/IViewport.h" | |
28 | |
29 #include <boost/weak_ptr.hpp> | |
30 | 26 |
31 namespace OrthancStone | 27 namespace OrthancStone |
32 { | 28 { |
33 namespace Internals | 29 namespace Internals |
34 { | 30 { |
35 // During a mouse event that modifies the view of a scene, keeps | 31 // During a mouse event that modifies the view of a scene, keeps |
36 // one point (the pivot) at a fixed position on the canvas | 32 // one point (the pivot) at a fixed position on the canvas |
37 class FixedPointAligner : public boost::noncopyable | 33 class FixedPointAligner : public boost::noncopyable |
38 { | 34 { |
39 private: | 35 private: |
40 boost::weak_ptr<IViewport> viewport_; | 36 ScenePoint2D pivot_; |
41 ScenePoint2D pivot_; | 37 ScenePoint2D canvas_; |
42 ScenePoint2D canvas_; | |
43 | |
44 /** | |
45 This will return a scoped lock to the viewport. | |
46 If the viewport does not exist anymore, then nullptr is returned. | |
47 */ | |
48 IViewport::ILock* GetViewportLock(); | |
49 | 38 |
50 public: | 39 public: |
51 FixedPointAligner(boost::weak_ptr<IViewport> viewport, | 40 FixedPointAligner(ViewportController& controller, |
52 const ScenePoint2D& p); | 41 const ScenePoint2D& p); |
53 | 42 |
54 void Apply(); | 43 void Apply(ViewportController& controller); |
55 }; | 44 }; |
56 } | 45 } |
57 } | 46 } |