comparison Framework/Viewport/WebAssemblyViewport.cpp @ 1318:cbfdba08e039 broker

removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 17 Mar 2020 08:40:13 +0100
parents 1a08b779be64
children fd616c4a5904
comparison
equal deleted inserted replaced
1317:8981bfca3457 1318:cbfdba08e039
201 { 201 {
202 compositor_.reset(compositor); 202 compositor_.reset(compositor);
203 } 203 }
204 } 204 }
205 205
206 206 WebAssemblyViewport::WebAssemblyViewport(
207 WebAssemblyViewport::WebAssemblyViewport(const std::string& canvasId, 207 const std::string& canvasId,
208 const Scene2D* scene) : 208 const Scene2D* scene,
209 boost::weak_ptr<UndoStack> undoStackW) :
209 shortCanvasId_(canvasId), 210 shortCanvasId_(canvasId),
210 fullCanvasId_("#" + canvasId), 211 fullCanvasId_(canvasId),
211 interactor_(new DefaultViewportInteractor) 212 interactor_(new DefaultViewportInteractor)
212 { 213 {
213 if (scene == NULL) 214 if(undoStackW.lock() != NULL)
215 {
216 controller_ = boost::make_shared<ViewportController>(*this,undoStackW);
217 }
218 else if (scene == NULL)
214 { 219 {
215 controller_ = boost::make_shared<ViewportController>(*this); 220 controller_ = boost::make_shared<ViewportController>(*this);
216 } 221 }
217 else 222 else
218 { 223 {
235 } 240 }
236 }, 241 },
237 canvasId.c_str() // $0 242 canvasId.c_str() // $0
238 ); 243 );
239 244
245 LOG(TRACE) << "2020-03-16-16h23 About to call emscripten_set_XXXX_callback on \""
246 << fullCanvasId_.c_str() << "\" from WebAssemblyViewport::WebAssemblyViewport";
247
248 #if 1
240 // It is not possible to monitor the resizing of individual 249 // It is not possible to monitor the resizing of individual
241 // canvas, so we track the full window of the browser 250 // canvas, so we track the full window of the browser
242 emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, OnResize); 251 emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, OnResize);
243 252
244 emscripten_set_mousedown_callback(fullCanvasId_.c_str(), this, false, OnMouseDown); 253 emscripten_set_mousedown_callback(fullCanvasId_.c_str(), this, false, OnMouseDown);
245 emscripten_set_mousemove_callback(fullCanvasId_.c_str(), this, false, OnMouseMove); 254 emscripten_set_mousemove_callback(fullCanvasId_.c_str(), this, false, OnMouseMove);
246 emscripten_set_mouseup_callback(fullCanvasId_.c_str(), this, false, OnMouseUp); 255 emscripten_set_mouseup_callback(fullCanvasId_.c_str(), this, false, OnMouseUp);
256 #endif
257 LOG(TRACE) << "2020-03-16-16h23 DONE calling emscripten_set_XXXX_callback on \""
258 << fullCanvasId_.c_str() << "\" from WebAssemblyViewport::WebAssemblyViewport";
247 } 259 }
248 260
249 261
250 IViewport::ILock* WebAssemblyViewport::Lock() 262 IViewport::ILock* WebAssemblyViewport::Lock()
251 { 263 {