dxf-viewer-example-src icon indicating copy to clipboard operation
dxf-viewer-example-src copied to clipboard

Sample App for reactjs

Open ali-faiz-brainx opened this issue 2 years ago • 2 comments

Hey there I don't know vue js too much and I want to make the same example for react js. Is there any GitHub repo that uses dxf-viewer or any blog?

ali-faiz-brainx avatar Nov 29 '22 14:11 ali-faiz-brainx

Hello, It should be quite easy. Most of public API is covered by several methods in DxfViewer.js, they are documented in the code as much as possible. Vue.js wrapper component demonstrates their invokations, it is pretty simple and does not require Vue.js knowledge to understand it. Basically, you create the viewer instance by providing container element, and some options (documented here). Then load the file. To utilize backgound loading, web-worker factory function should be provided (otherwise it will load in UI thread which may make it unresponsive while loading), this example uses webpack worker loader to get such factory function (it can be vanilla JS function like ()=>new Worker('my-worker-script.js')). Worker script should invoke DxfViewer.SetupWorker() which implements whole the worker functionality. Working with layers is also pretty simple and can be checked here.

vagran avatar Dec 01 '22 08:12 vagran

I will try to find some time and add a brief description of the above to the package readme.

vagran avatar Dec 01 '22 08:12 vagran