Prepare changes for review and preview build

This commit is contained in:
Kurt Hutten
2021-11-21 18:12:56 +11:00
parent b1ff7796b9
commit 0face9b9c1
6 changed files with 18 additions and 10 deletions

View File

@@ -37,8 +37,8 @@ model User {
enum CadPackage {
openscad
cadquery
jscad // TODO #422, add jscad to db schema when were ready to enable saving of jscad projects
curv
jscad
// curv // TODO uncomment when ready for users to save curv projects
}
model Project {

View File

@@ -25,6 +25,7 @@ const CaptureButtonViewer = ({
const threeInstance = React.useRef(null)
const [dataType, dataTypeSetter] = useState(state?.objectData?.type)
const [artifact, artifactSetter] = useState(state?.objectData?.data)
const [ideType] = useState(state?.ideType)
const [isLoading, isLoadingSetter] = useState(false)
const [camera, cameraSetter] = useState<State['camera'] | null>(null)
const getThreeInstance = (_threeInstance) => {
@@ -70,6 +71,7 @@ const CaptureButtonViewer = ({
isLoading={isLoading}
camera={camera}
isMinimal
ideType={ideType}
/>
)
}

View File

@@ -69,7 +69,7 @@ export const makeStlDownloadHandler =
} else {
thunkDispatch((dispatch, getState) => {
const state = getState()
const specialCadProcess = ideType === 'openscad' && 'stl'
const specialCadProcess = (ideType === 'openscad' || ideType === 'curv') && 'stl'
dispatch({ type: 'setLoading' })
requestRender({
state,

View File

@@ -10,6 +10,7 @@ const IdeViewer = ({
const { state, thunkDispatch } = useIdeContext()
const dataType = state.objectData?.type
const artifact = state.objectData?.data
const ideType = state.ideType
const onInit = (threeInstance) => {
thunkDispatch({ type: 'setThreeInstance', payload: threeInstance })
@@ -44,6 +45,7 @@ const IdeViewer = ({
onCameraChange={onCameraChange}
isLoading={state.isLoading}
camera={state?.camera}
ideType={ideType}
/>
)
}

View File

@@ -169,6 +169,7 @@ export function PureIdeViewer({
isMinimal = false,
scadRatio = 1,
camera,
ideType
}: {
dataType: 'INIT' | ArtifactTypes
artifact: any
@@ -178,6 +179,7 @@ export function PureIdeViewer({
isMinimal?: boolean
scadRatio?: number
camera?: State['camera']
ideType?: State['ideType']
}) {
const [isDragging, setIsDragging] = useState(false)
const [image, setImage] = useState()
@@ -216,6 +218,8 @@ export function PureIdeViewer({
)}
<div // eslint-disable-line jsx-a11y/no-static-element-interactions
className={`opacity-0 absolute inset-0 transition-opacity duration-500 ${
ideType === 'curv' ? // TODO hide axes while curve doesn't have a controllable camera
'opacity-0' :
!(isDragging || dataType !== 'png')
? 'hover:opacity-50'
: 'opacity-100'

View File

@@ -95,13 +95,13 @@ const menuOptions: {
dotClasses: 'bg-yellow-300',
ideType: 'jscad',
},
{
name: 'Curv',
sub: 'beta',
bgClasses: 'bg-ch-blue-700',
dotClasses: 'bg-blue-800',
ideType: 'curv',
},
// { // TODO uncomment when ready for users to save curv projects
// name: 'Curv',
// sub: 'beta',
// bgClasses: 'bg-ch-blue-700',
// dotClasses: 'bg-blue-800',
// ideType: 'curv',
// },
]
const NavPlusButton: React.FC = () => {