Update integration to use bundled version of CascadeStudio
resolves #139
This commit is contained in:
@@ -4,9 +4,35 @@ module.exports = (config, { env }) => {
|
||||
config.plugins.forEach((plugin) => {
|
||||
if (plugin.constructor.name === 'HtmlWebpackPlugin') {
|
||||
plugin.options.favicon = './src/favicon.svg'
|
||||
} else if (plugin.constructor.name === 'CopyPlugin') {
|
||||
plugin.patterns.push({
|
||||
from: './src/cascade/js/StandardLibraryIntellisense.ts',
|
||||
to: 'js/StandardLibraryIntellisense.ts',
|
||||
})
|
||||
plugin.patterns.push({
|
||||
from: './src/cascade/static_node_modules/opencascade.js/dist/oc.d.ts',
|
||||
to: 'opencascade.d.ts',
|
||||
})
|
||||
plugin.patterns.push({
|
||||
from: '../node_modules/three/src/Three.d.ts',
|
||||
to: 'Three.d.ts',
|
||||
})
|
||||
plugin.patterns.push({
|
||||
from: './src/cascade/fonts',
|
||||
to: 'fonts',
|
||||
})
|
||||
plugin.patterns.push({
|
||||
from: './src/cascade/textures',
|
||||
to: 'textures',
|
||||
})
|
||||
}
|
||||
})
|
||||
config.plugins.push(new MonacoWebpackPlugin())
|
||||
config.module.rules[0].oneOf.push({
|
||||
test: /opencascade\.wasm\.wasm$/,
|
||||
type: 'javascript/auto',
|
||||
loader: 'file-loader',
|
||||
})
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
@@ -42,7 +42,9 @@
|
||||
"devDependencies": {
|
||||
"autoprefixer": "9.8.6",
|
||||
"html-webpack-plugin": "^4.5.0",
|
||||
"opentype.js": "^1.3.3",
|
||||
"postcss-loader": "4.0.2",
|
||||
"tailwindcss": "^1.9.1"
|
||||
"tailwindcss": "^1.9.1",
|
||||
"worker-loader": "^3.0.7"
|
||||
}
|
||||
}
|
||||
|
||||
Submodule web/src/cascade updated: 33d1b225f7...69e7864059
@@ -2,6 +2,7 @@ import { useAuth } from '@redwoodjs/auth'
|
||||
import CascadeController from 'src/helpers/cascadeController'
|
||||
import IdeToolbar from 'src/components/IdeToolbar'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { threejsViewport } from 'src/cascade/js/MainPage/CascadeState'
|
||||
|
||||
const defaultExampleCode = `// Welcome to Cascade Studio! Here are some useful functions:
|
||||
// Translate(), Rotate(), Scale(), Union(), Difference(), Intersection()
|
||||
|
||||
@@ -292,23 +292,16 @@ const IdeToolbar = ({
|
||||
transformOrigin={transformOrigin}
|
||||
className="material-ui-overrides transform translate-y-4"
|
||||
>
|
||||
<div className="text-sm p-2 text-gray-500 max-w-md">
|
||||
<div className="text-sm p-4 text-gray-500 max-w-md">
|
||||
<div className="text-base text-gray-700 py-2">
|
||||
Model never generating?
|
||||
Can't export stl/obj/STEP?
|
||||
</div>
|
||||
Due to the current integration with CascadeStudio and the order in
|
||||
which the code initialise sometimes the 3d model never generates
|
||||
<div className="text-base text-gray-700 py-2">Work around</div>
|
||||
<p>
|
||||
Usually going to the <a href="/">homepage</a>, then refreshing,
|
||||
waiting a good 10 seconds before navigating back to the part
|
||||
your interested in should fix the issue.
|
||||
</p>
|
||||
Currently exports are only working for chrome and edge browsers
|
||||
<p>
|
||||
If this problem is frustrating to you, leave a comment on its{' '}
|
||||
<OutBound
|
||||
className="text-gray-600 underline"
|
||||
to="https://github.com/Irev-Dev/cadhub/issues/139"
|
||||
to="https://github.com/zalo/CascadeStudio/pull/39#issuecomment-766206091"
|
||||
>
|
||||
github issue
|
||||
</OutBound>{' '}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { initialize, getEditor } from 'src/cascade/js/MainPage/CascadeMain'
|
||||
import { initialize } from 'src/cascade/js/MainPage/CascadeMain'
|
||||
import { monacoEditor } from 'src/cascade/js/MainPage/CascadeState'
|
||||
|
||||
class CascadeController {
|
||||
_hasInitialised = false
|
||||
@@ -9,14 +10,14 @@ class CascadeController {
|
||||
|
||||
initialise(onCodeChange, code) {
|
||||
const onInit = () => {
|
||||
const editor = getEditor()
|
||||
const editor = monacoEditor
|
||||
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, onInit)
|
||||
new initialize(this.controllerOnCodeChange, code, onInit)
|
||||
this._hasInitialised = true
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user