vagran / dxf-viewer-example-src

Source for dxf-viewer-example GitHub pages repository
MIT License
46 stars 24 forks source link

Sample App for reactjs #12

Open ali-faiz-brainx opened 1 year ago

ali-faiz-brainx commented 1 year ago

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?

vagran commented 1 year ago

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 commented 1 year ago

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