1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0032433: Visualization, TKService - introduce Wasm_Window implementing Aspect_Window interface using Emscripten SDK

Introduced Wasm_Window implementing Aspect_Window interface.

Aspect_WindowInputListener has been extended by touch input callbacks (moved from AIS_ViewController),
which now implements redirection of single taps to UpdateMouseClick().

AIS_ViewController::FetchNavigationKeys() now requests more frames even if Delta is zero,
but navigation keys are pressed - indicated by a new flag AIS_WalkDelta::IsDefined().

Fixed missing implementation of Xw_Window::DisplayConnection() getter.
The property has been moved to the base class Aspect_Window.

Removed unused Aspect_Convert.hxx.

DRAWEXE targeting Wasm:
- added exposing of FS interface so that it is possible uploading/downloading files to/from emulated file system on JavaScript level;
- added printer redirecting messages to Module.printMessage callback accepting message gravity;
- Run_Appli() now skips std::cin when Module.noExitRuntime is set.
This commit is contained in:
kgv
2021-04-25 17:51:49 +03:00
committed by bugmaster
parent 7b3a032f1e
commit f9ab9f7f1c
28 changed files with 1743 additions and 775 deletions

View File

@@ -136,9 +136,6 @@ private:
//! Application event loop.
void mainloop();
//! Request view redrawing.
void updateView();
//! Flush events and redraw view.
void redrawView();
@@ -146,25 +143,24 @@ private:
virtual void handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView) override;
//! Schedule processing of window input events with the next repaint event.
virtual void ProcessInput() override;
//! Handle key down event.
virtual void KeyDown (Aspect_VKey theKey,
double theTime,
double thePressure) override;
//! Handle key up event.
virtual void KeyUp (Aspect_VKey theKey,
double theTime) override;
//! Dump WebGL context information.
void dumpGlInfo (bool theIsBasic);
//! Initialize pixel scale ratio.
void initPixelScaleRatio();
//! Return point from logical units to backing store.
Graphic3d_Vec2d convertPointToBacking (const Graphic3d_Vec2d& thePnt) const
{
return thePnt * myDevicePixelRatio;
}
//! Return point from logical units to backing store.
Graphic3d_Vec2i convertPointToBacking (const Graphic3d_Vec2i& thePnt) const
{
Graphic3d_Vec2d aPnt = Graphic3d_Vec2d (thePnt) * myDevicePixelRatio + Graphic3d_Vec2d (0.5);
return Graphic3d_Vec2i (aPnt);
}
//! @name Emscripten callbacks
private:
//! Window resize event.
@@ -245,8 +241,7 @@ private:
Handle(Prs3d_TextAspect) myTextStyle; //!< text style for OSD elements
Handle(AIS_ViewCube) myViewCube; //!< view cube object
TCollection_AsciiString myCanvasId; //!< canvas element id on HTML page
Aspect_Touch myClickTouch; //!< single touch position for handling clicks
OSD_Timer myDoubleTapTimer; //!< timer for handling double tap
Graphic3d_Vec2i myWinSizeOld;
float myDevicePixelRatio; //!< device pixel ratio for handling high DPI displays
unsigned int myUpdateRequests; //!< counter for unhandled update requests