Skip to content

Commit

Permalink
[#102] Fix exception from three.js (bounding spheres calculation)
Browse files Browse the repository at this point in the history
Disable object sorting based on bounding spheres.
Dependencies update and version bump.
  • Loading branch information
vagran committed Feb 27, 2024
1 parent c485a1e commit aa93783
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dxf-viewer",
"version": "1.0.29",
"version": "1.0.31",
"description": "JavaScript DXF file viewer",
"main": "src/index.js",
"author": "Artyom Lebedev<artyom.lebedev@gmail.com>",
Expand All @@ -21,9 +21,11 @@
"CONTRIBUTORS"
],
"dependencies": {
"@types/three": "^0.149.0",
"three": "^0.150.1",
"loglevel": "^1.8.1",
"three": "^0.161.0",
"loglevel": "^1.9.1",
"opentype.js": "^1.3.4"
},
"devDependencies": {
"@types/three": "^0.161.2"
}
}
4 changes: 4 additions & 0 deletions src/DxfViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export class DxfViewer {
return
}
const renderer = this.renderer
/* Prevent bounding spheres calculations which fails due to non-conventional geometry
* buffers layout. Also do not waste CPU on sorting which we do not need anyway.
*/
renderer.sortObjects = false
renderer.setPixelRatio(window.devicePixelRatio)

const camera = this.camera = new three.OrthographicCamera(-1, 1, 1, -1, 0.1, 2);
Expand Down

0 comments on commit aa93783

Please sign in to comment.