comparison OrthancStone/Sources/Scene2D/Internals/FixedPointAligner.h @ 1606:874e178f34e9

- ViewportController now has weak ptr to Viewport - Measuring tools + related commands and all trackers now store only a weak_ptr to the Viewport and lock() on demand for usage - LayerHolder and FixedPoint aligner store only a weak_ptr to the Viewport, too - Fixed float/double warning in GrayscaleWindowingSceneTracker
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 28 Oct 2020 20:14:34 +0100
parents 8563ea5d8ae4
children 9ac2a65d4172
comparison
equal deleted inserted replaced
1605:b3c439d96d3e 1606:874e178f34e9
34 // During a mouse event that modifies the view of a scene, keeps 34 // During a mouse event that modifies the view of a scene, keeps
35 // one point (the pivot) at a fixed position on the canvas 35 // one point (the pivot) at a fixed position on the canvas
36 class FixedPointAligner : public boost::noncopyable 36 class FixedPointAligner : public boost::noncopyable
37 { 37 {
38 private: 38 private:
39 boost::shared_ptr<IViewport> viewport_; 39 boost::weak_ptr<IViewport> viewport_;
40 ScenePoint2D pivot_; 40 ScenePoint2D pivot_;
41 ScenePoint2D canvas_; 41 ScenePoint2D canvas_;
42
43 /**
44 This will return a scoped lock to the viewport.
45 If the viewport does not exist anymore, then nullptr is returned.
46 */
47 IViewport::ILock* GetViewportLock();
42 48
43 public: 49 public:
44 FixedPointAligner(boost::shared_ptr<IViewport> viewport, 50 FixedPointAligner(boost::weak_ptr<IViewport> viewport,
45 const ScenePoint2D& p); 51 const ScenePoint2D& p);
46 52
47 void Apply(); 53 void Apply();
48 }; 54 };
49 } 55 }