comparison Applications/Platforms/WebAssembly/WebAssemblyViewport.cpp @ 1811:fdc6a8089eb9

hovering of annotations in Stone Web viewer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 May 2021 11:29:53 +0200
parents 9ac2a65d4172
children 3889ae96d2e9
comparison
equal deleted inserted replaced
1810:b05d5f0d014f 1811:fdc6a8089eb9
172 { 172 {
173 PointerEvent pointer; 173 PointerEvent pointer;
174 ConvertMouseEvent(pointer, *mouseEvent, *that->compositor_); 174 ConvertMouseEvent(pointer, *mouseEvent, *that->compositor_);
175 175
176 that->controller_->HandleMousePress(*that->interactor_, pointer, 176 that->controller_->HandleMousePress(*that->interactor_, pointer,
177 that->compositor_->GetCanvasWidth(), 177 that->compositor_->GetCanvasWidth(),
178 that->compositor_->GetCanvasHeight()); 178 that->compositor_->GetCanvasHeight());
179 that->Invalidate(); 179 that->Invalidate();
180 } 180 }
181 181
182 LOG(TRACE) << "Exiting: " << __func__; 182 LOG(TRACE) << "Exiting: " << __func__;
183 return true; 183 return true;
186 186
187 EM_BOOL WebAssemblyViewport::OnMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) 187 EM_BOOL WebAssemblyViewport::OnMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
188 { 188 {
189 WebAssemblyViewport* that = reinterpret_cast<WebAssemblyViewport*>(userData); 189 WebAssemblyViewport* that = reinterpret_cast<WebAssemblyViewport*>(userData);
190 190
191 if (that->compositor_.get() != NULL && 191 if (that->compositor_.get() != NULL)
192 that->controller_->HasActiveTracker()) 192 {
193 { 193 if (that->controller_->HasActiveTracker())
194 PointerEvent pointer;
195 ConvertMouseEvent(pointer, *mouseEvent, *that->compositor_);
196 if (that->controller_->HandleMouseMove(pointer))
197 { 194 {
198 that->Invalidate(); 195 PointerEvent pointer;
196 ConvertMouseEvent(pointer, *mouseEvent, *that->compositor_);
197
198 if (that->controller_->HandleMouseMove(pointer))
199 {
200 that->Invalidate();
201 }
202 }
203 else if (that->interactor_.get() != NULL &&
204 that->interactor_->HasMouseHover())
205 {
206 // New in Stone Web viewer 2.0
207 PointerEvent pointer;
208 ConvertMouseEvent(pointer, *mouseEvent, *that->compositor_);
209 that->interactor_->HandleMouseHover(*that, pointer);
199 } 210 }
200 } 211 }
201 212
202 LOG(TRACE) << "Exiting: " << __func__; 213 LOG(TRACE) << "Exiting: " << __func__;
203 return true; 214 return true;