Merge pull request #106 from Irev-Dev/main

Release 17th november
This commit was merged in pull request #106.
This commit is contained in:
Kurt Hutten
2020-11-17 19:21:32 +11:00
committed by GitHub
5 changed files with 16 additions and 11 deletions

View File

@@ -1,9 +1,13 @@
![CadHub banner](https://raw.githubusercontent.com/Irev-Dev/repo-images/main/images/gear%20donutbanner.png)
# [C a d H u b](https://cadhub.xyz)
[![Netlify Status](https://api.netlify.com/api/v1/badges/77f37543-e54a-4723-8136-157c0221ec27/deploy-status)](https://app.netlify.com/sites/cadhubxyz/deploys)
CadHub aims to be a community website for javascript based code-cad. Currently trying to integrate [cascadeStudio](https://zalo.github.io/CascadeStudio/), but if successful plan to also integrate [JSCAD](https://openjscad.org/).
OpenScad has proven code-cad a much loved formate for cad-modeling. Joining code-cad to a mature language like javascript that has a package manager (npm) plus a community hub for sharing cad models like CadHub, we're going to build a thriving community.
CadHub aims to be a community website for code-cad. Currently trying to integrate the excellent [cascadeStudio](https://zalo.github.io/CascadeStudio/), but maybe more in future.
OpenScad has proven that code-cad is a much loved format for cad-modeling. We're going to build a thriving community.
If you want to be involved in anyway, swing by the [discord channel](https://discord.gg/SD7zFRNjGH).
<img src="https://raw.githubusercontent.com/Irev-Dev/repo-images/main/images/Parts%20Page.jpg">

View File

@@ -4,8 +4,6 @@ import CascadeController from 'src/helpers/cascadeController'
import IdeToolbar from 'src/components/IdeToolbar'
import { useEffect, useState } from 'react'
const domNode = document.createElement('div').setAttribute('id', 'sickId')
const IdeCascadeStudio = ({ part, saveCode, loading, error }) => {
const [code, setCode] = useState(part.code)
const { currentUser } = useAuth()
@@ -15,7 +13,7 @@ const IdeCascadeStudio = ({ part, saveCode, loading, error }) => {
// "opening" and "closing" it for the ide part of the app by displaying none or block. Which is why this useEffect
// returns a clean up function that hides the div again.
const onCodeChange = (code) => setCode(code)
CascadeController.initialise(onCodeChange, part.code, domNode)
CascadeController.initialise(onCodeChange, part.code)
const element = document.getElementById('cascade-container')
element.setAttribute('style', 'display: block; opacity: 100%; overflow: hidden; height: calc(100vh - 8rem)') // eslint-disable-line
return () => {

View File

@@ -14,6 +14,7 @@ export const QUERY = gql`
user {
id
userName
image
}
}
}

View File

@@ -8,17 +8,19 @@ class CascadeController {
}
initialise(onCodeChange, code) {
const onInit = () => {
const editor = getEditor()
editor.setValue(code)
editor.evaluateCode(false)
}
// only inits on first call, after that it just updates the editor and revaluates code, maybe should rename?
this.incomingOnCodeChang = onCodeChange
if (!this._hasInitialised) {
initialize(this.controllerOnCodeChange, code)
initialize(this.controllerOnCodeChange, code, onInit)
this._hasInitialised = true
return
}
const editor = getEditor()
editor.setValue(code)
editor.evaluateCode(false)
return this.domNode
onInit()
}
}