Skip to content

Commit

Permalink
small timeouts to update the ui (#21)
Browse files Browse the repository at this point in the history
* Update dependencies, use yarn2

* Wait all 200 lines to avoid blocking the UI.
  • Loading branch information
aligator authored Apr 21, 2023
1 parent d3bfd3d commit 8808901
Show file tree
Hide file tree
Showing 13 changed files with 6,829 additions and 4,824 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ dist
node_modules
*.log
_bundles
dist-esm
dist-esm

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
541 changes: 541 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.0.cjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.5.0.cjs
2 changes: 1 addition & 1 deletion example/extended.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- <script src="../_bundles/gcode-viewer.js"></script> -->

<!-- In production you should serve this on your own. -->
<script src="https://unpkg.com/gcode-viewer@0.4.0/_bundles/gcode-viewer.js"></script>
<script src="https://unpkg.com/gcode-viewer@0.5.0/_bundles/gcode-viewer.js"></script>

<!-- Normalize css just for example purposes. In Production you should use a propper way https://necolas.github.io/normalize.css/ -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
Expand Down
2 changes: 1 addition & 1 deletion example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<!-- <script src="../_bundles/gcode-viewer.js"></script> -->

<!-- In production you should serve this on your own. -->
<script src="https://unpkg.com/gcode-viewer@0.4.0/_bundles/gcode-viewer.js"></script>
<script src="https://unpkg.com/gcode-viewer@0.5.0/_bundles/gcode-viewer.js"></script>
</head>

<body>
Expand Down
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gcode-viewer",
"version": "0.4.1",
"version": "0.5.0",
"description": "A simple gcode viewer lib using three.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -14,22 +14,24 @@
],
"scripts": {
"clean": "rm -rf _bundles dist dist-esm",
"build": "yarn clean && tsc && tsc -m es6 --outDir dist-esm && webpack",
"build": "NODE_ENV=production && yarn clean && tsc && tsc -m es6 --outDir dist-esm && webpack",
"build:dev": "yarn clean && tsc && tsc -m es6 --outDir dist-esm && webpack",
"prepublish": "yarn build && yarn test",
"test": "jest"
},
"dependencies": {
"three": "^0.128.0"
"three": "^0.151.3"
},
"devDependencies": {
"@types/jest": "^26.0.23",
"@types/three": "^0.127.1",
"jest": "^26.6.3",
"ts-jest": "^26.5.6",
"ts-loader": "^9.1.1",
"typescript": "^4.2.4",
"@types/jest": "^29.5.0",
"@types/three": "^0.150.1",
"jest": "^29.5.0",
"ts-jest": "^29.1.0",
"ts-loader": "^9.4.2",
"typescript": "^5.0.4",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^5.36.2",
"webpack-cli": "^4.6.0"
}
"webpack": "^5.79.0",
"webpack-cli": "^5.0.1"
},
"packageManager": "[email protected]"
}
4 changes: 3 additions & 1 deletion src/LineTubeGeometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export class LineTubeGeometry extends BufferGeometry {

constructor(radialSegments = 8) {
super()

//@ts-ignore
this.type = 'LineTubeGeometry'
this.pointsLength = 0
this.radialSegments = radialSegments
Expand Down Expand Up @@ -255,7 +257,7 @@ export class LineTubeGeometry extends BufferGeometry {
}
}

toJSON() {
toJSON(): string {
throw new Error("not implemented")
}

Expand Down
5 changes: 2 additions & 3 deletions src/gcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,12 @@ export class GCodeRenderer {
* Reads the GCode and renders it to a mesh.
*/
public async render() {
this.parser.parse()
await this.parser.parse()

this.parser.getGeometries().forEach(g => {
this.scene.add(new Mesh(g, this.lineMaterial))
});

this.setupScene()
this.setupScene()
}

private draw() {
Expand Down
Loading

0 comments on commit 8808901

Please sign in to comment.