Mercurial > hg > orthanc-stone
annotate Framework/Deprecated/Widgets/WorldSceneWidget.cpp @ 1055:af456106576c
moving GetCanvasIdentifier from IViewport to WebAssemblyViewport
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Oct 2019 16:07:58 +0200 |
parents | c35e98d22764 |
children | f8bff27f1314 |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
439 | 5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
47 | 8 * modify it under the terms of the GNU Affero General Public License |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
0 | 11 * |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
47 | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Affero General Public License for more details. | |
281 | 16 * |
47 | 17 * You should have received a copy of the GNU Affero General Public License |
0 | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | |
20 | |
21 | |
22 #include "WorldSceneWidget.h" | |
23 | |
332
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
24 #include "PanMouseTracker.h" |
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
25 #include "ZoomMouseTracker.h" |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
26 #include "PanZoomMouseTracker.h" |
332
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
27 |
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
28 #include <Core/Logging.h> |
403 | 29 #include <Core/OrthancException.h> |
332
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
30 |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
109
diff
changeset
|
31 #include <math.h> |
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
109
diff
changeset
|
32 #include <memory> |
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
109
diff
changeset
|
33 #include <cassert> |
0 | 34 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
35 namespace Deprecated |
0 | 36 { |
281 | 37 // this is an adapter between a IWorldSceneMouseTracker |
38 // that is tracking a mouse in scene coordinates/mm and | |
39 // an IMouseTracker that is tracking a mouse | |
40 // in screen coordinates/pixels. | |
0 | 41 class WorldSceneWidget::SceneMouseTracker : public IMouseTracker |
42 { | |
43 private: | |
332
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
44 ViewportGeometry view_; |
0 | 45 std::auto_ptr<IWorldSceneMouseTracker> tracker_; |
281 | 46 |
0 | 47 public: |
48 SceneMouseTracker(const ViewportGeometry& view, | |
49 IWorldSceneMouseTracker* tracker) : | |
50 view_(view), | |
51 tracker_(tracker) | |
52 { | |
332
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
53 if (tracker == NULL) |
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
54 { |
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
55 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
56 } |
0 | 57 } |
58 | |
59 virtual void Render(Orthanc::ImageAccessor& target) | |
60 { | |
332
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
61 if (tracker_->HasRender()) |
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
62 { |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
63 OrthancStone::CairoSurface surface(target, false /* no alpha */); |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
64 OrthancStone::CairoContext context(surface); |
332
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
65 view_.ApplyTransform(context); |
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
66 tracker_->Render(context, view_.GetZoom()); |
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
67 } |
0 | 68 } |
69 | |
281 | 70 virtual void MouseUp() |
0 | 71 { |
72 tracker_->MouseUp(); | |
73 } | |
74 | |
281 | 75 virtual void MouseMove(int x, |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
76 int y, |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
77 const std::vector<Touch>& displayTouches) |
0 | 78 { |
79 double sceneX, sceneY; | |
332
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
80 view_.MapPixelCenterToScene(sceneX, sceneY, x, y); |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
81 |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
82 std::vector<Touch> sceneTouches; |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
83 for (size_t t = 0; t < displayTouches.size(); t++) |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
84 { |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
85 double sx, sy; |
693
9a474e90e832
Fixed a bunch of truncation warnings in various parts of the library
Benjamin Golinvaux <bgo@osimis.io>
parents:
561
diff
changeset
|
86 |
9a474e90e832
Fixed a bunch of truncation warnings in various parts of the library
Benjamin Golinvaux <bgo@osimis.io>
parents:
561
diff
changeset
|
87 view_.MapPixelCenterToScene( |
9a474e90e832
Fixed a bunch of truncation warnings in various parts of the library
Benjamin Golinvaux <bgo@osimis.io>
parents:
561
diff
changeset
|
88 sx, sy, (int)displayTouches[t].x, (int)displayTouches[t].y); |
9a474e90e832
Fixed a bunch of truncation warnings in various parts of the library
Benjamin Golinvaux <bgo@osimis.io>
parents:
561
diff
changeset
|
89 |
9a474e90e832
Fixed a bunch of truncation warnings in various parts of the library
Benjamin Golinvaux <bgo@osimis.io>
parents:
561
diff
changeset
|
90 sceneTouches.push_back( |
9a474e90e832
Fixed a bunch of truncation warnings in various parts of the library
Benjamin Golinvaux <bgo@osimis.io>
parents:
561
diff
changeset
|
91 Touch(static_cast<float>(sx), static_cast<float>(sy))); |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
92 } |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
93 tracker_->MouseMove(x, y, sceneX, sceneY, displayTouches, sceneTouches); |
0 | 94 } |
95 }; | |
96 | |
97 | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
98 bool WorldSceneWidget::RenderCairo(OrthancStone::CairoContext& context) |
0 | 99 { |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
100 view_.ApplyTransform(context); |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
101 return RenderScene(context, view_); |
0 | 102 } |
103 | |
104 | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
105 void WorldSceneWidget::RenderMouseOverCairo(OrthancStone::CairoContext& context, |
0 | 106 int x, |
107 int y) | |
108 { | |
109 ViewportGeometry view = GetView(); | |
110 view.ApplyTransform(context); | |
111 | |
112 double sceneX, sceneY; | |
332
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
113 view.MapPixelCenterToScene(sceneX, sceneY, x, y); |
331
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
114 |
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
115 if (interactor_) |
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
116 { |
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
117 interactor_->MouseOver(context, *this, view, sceneX, sceneY, GetStatusBar()); |
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
118 } |
0 | 119 } |
120 | |
121 | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
122 void WorldSceneWidget::SetSceneExtent(ViewportGeometry& view) |
0 | 123 { |
109
53bd9277b025
using the Extent class
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
91
diff
changeset
|
124 view.SetSceneExtent(GetSceneExtent()); |
0 | 125 } |
126 | |
127 | |
128 void WorldSceneWidget::SetSize(unsigned int width, | |
129 unsigned int height) | |
130 { | |
131 CairoWidget::SetSize(width, height); | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
132 view_.SetDisplaySize(width, height); |
0 | 133 } |
134 | |
135 | |
136 void WorldSceneWidget::SetInteractor(IWorldSceneInteractor& interactor) | |
137 { | |
138 interactor_ = &interactor; | |
139 } | |
140 | |
141 | |
330 | 142 void WorldSceneWidget::FitContent() |
0 | 143 { |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
144 SetSceneExtent(view_); |
330 | 145 view_.FitContent(); |
0 | 146 |
278 | 147 NotifyContentChanged(); |
0 | 148 } |
149 | |
150 | |
151 void WorldSceneWidget::SetView(const ViewportGeometry& view) | |
152 { | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
153 view_ = view; |
0 | 154 |
278 | 155 NotifyContentChanged(); |
0 | 156 } |
157 | |
158 | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
159 IMouseTracker* WorldSceneWidget::CreateMouseTracker(OrthancStone::MouseButton button, |
0 | 160 int x, |
161 int y, | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
162 OrthancStone::KeyboardModifiers modifiers, |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
163 const std::vector<Touch>& touches) |
0 | 164 { |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
165 double sceneX, sceneY; |
332
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
166 view_.MapPixelCenterToScene(sceneX, sceneY, x, y); |
0 | 167 |
281 | 168 // asks the Widget Interactor to provide a mouse tracker |
331
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
169 std::auto_ptr<IWorldSceneMouseTracker> tracker; |
0 | 170 |
331
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
171 if (interactor_) |
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
172 { |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
173 tracker.reset(interactor_->CreateMouseTracker(*this, view_, button, modifiers, x, y, sceneX, sceneY, GetStatusBar(), touches)); |
331
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
174 } |
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
175 |
0 | 176 if (tracker.get() != NULL) |
177 { | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
178 return new SceneMouseTracker(view_, tracker.release()); |
0 | 179 } |
333
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
180 else if (hasDefaultMouseEvents_) |
0 | 181 { |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
182 printf("has default mouse events\n"); |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
183 if (touches.size() == 2) |
333
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
184 { |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
185 printf("2 touches !\n"); |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
186 return new SceneMouseTracker(view_, new PanZoomMouseTracker(*this, touches)); |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
187 } |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
188 else |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
189 { |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
190 switch (button) |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
191 { |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
192 case OrthancStone::MouseButton_Middle: |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
193 return new SceneMouseTracker(view_, new PanMouseTracker(*this, x, y)); |
333
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
194 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
195 case OrthancStone::MouseButton_Right: |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
196 return new SceneMouseTracker(view_, new ZoomMouseTracker(*this, x, y)); |
0 | 197 |
457
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
198 default: |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
199 return NULL; |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
200 } |
3b4df9925db6
added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
Alain Mazy <alain@mazy.be>
parents:
439
diff
changeset
|
201 } |
333
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
202 } |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
203 else |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
204 { |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
205 return NULL; |
0 | 206 } |
207 } | |
208 | |
209 | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
210 void WorldSceneWidget::MouseWheel(OrthancStone::MouseWheelDirection direction, |
0 | 211 int x, |
212 int y, | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
213 OrthancStone::KeyboardModifiers modifiers) |
0 | 214 { |
215 if (interactor_) | |
216 { | |
217 interactor_->MouseWheel(*this, direction, modifiers, GetStatusBar()); | |
218 } | |
219 } | |
220 | |
221 | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
222 void WorldSceneWidget::KeyPressed(OrthancStone::KeyboardKeys key, |
327 | 223 char keyChar, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
693
diff
changeset
|
224 OrthancStone::KeyboardModifiers modifiers) |
0 | 225 { |
226 if (interactor_) | |
227 { | |
327 | 228 interactor_->KeyPressed(*this, key, keyChar, modifiers, GetStatusBar()); |
0 | 229 } |
230 } | |
231 } |