diff --git a/demo/gif/extrude.xcf b/demo/gif/extrude.xcf
index d8e9b68..884cc82 100644
Binary files a/demo/gif/extrude.xcf and b/demo/gif/extrude.xcf differ
diff --git a/demo/gif/sketch.xcf b/demo/gif/sketch.xcf
index d3e2fdd..77e77aa 100644
Binary files a/demo/gif/sketch.xcf and b/demo/gif/sketch.xcf differ
diff --git a/demo/headphones-stand.json.gz b/demo/headphone-stand.json.gz
similarity index 100%
rename from demo/headphones-stand.json.gz
rename to demo/headphone-stand.json.gz
diff --git a/dist/3dprint.mp4 b/dist/3dprint.mp4
new file mode 100644
index 0000000..2962099
Binary files /dev/null and b/dist/3dprint.mp4 differ
diff --git a/dist/extrude.png b/dist/extrude.png
index 602fbd4..ac3aaa8 100644
Binary files a/dist/extrude.png and b/dist/extrude.png differ
diff --git a/dist/headphones-stand.json.gz b/dist/headphone-stand.json.gz
similarity index 100%
rename from dist/headphones-stand.json.gz
rename to dist/headphone-stand.json.gz
diff --git a/dist/sketch.png b/dist/sketch.png
index 308c7ae..27a8bd9 100644
Binary files a/dist/sketch.png and b/dist/sketch.png differ
diff --git a/src/react/app.jsx b/src/react/app.jsx
index f94d5d6..a7152a8 100644
--- a/src/react/app.jsx
+++ b/src/react/app.jsx
@@ -25,12 +25,10 @@ if (process.env.NODE_ENV === 'production') {
const visitedFlagStorage = sessionStorage
const App = ({ store }) => {
- const [modal, setModal] = useState(!visitedFlagStorage.getItem('visited'))
return
- {modal && < Help {...{ setModal }} />}
}
diff --git a/src/react/clip.jsx b/src/react/clip.jsx
index 48c3098..5bdb963 100644
--- a/src/react/clip.jsx
+++ b/src/react/clip.jsx
@@ -1,34 +1,40 @@
import React, { useState, useEffect, useRef, useCallback, useReducer } from "react"
-import { MdCancel} from 'react-icons/md'
+import { MdCancel } from 'react-icons/md'
export const Clip = ({ setClip, clip }) => {
let width;
if (window.innerWidth / 1.6 > window.innerHeight) {
- width = window.innerHeight * 1.6
+ width = window.innerHeight * 1.6
} else {
- width = window.innerWidth
+ width = window.innerWidth
}
- width = Math.min(width* 0.9, 1024)
+ width = Math.min(width * 0.9, 1024)
const top = (window.innerHeight - (width / 1.6) - 32) / 2
// console.log(width, width/1.6, window.innerHeight, top)
return (
-
-
+
{clip[1]}
+
setClip(null)}
+ />
-
+
)
}
diff --git a/src/react/help.jsx b/src/react/help.jsx
index 165fe4a..08a7fff 100644
--- a/src/react/help.jsx
+++ b/src/react/help.jsx
@@ -48,7 +48,7 @@ function reducer(state, action) {
case 'drag':
const dragLeft = state.dragLeft - action.move
- if (dragLeft < 0 || dragLeft > state.rect * arr.length) {
+ if (dragLeft < 0 || dragLeft > state.rect * arr.length - 1) {
return state
} else {
return {
@@ -77,7 +77,7 @@ const arr = [
['Sketch out your idea in a 2D outline.', 'sketch.png'],
['Transform the sketched shape into a 3D solid.', 'extrude.png'],
['Use additional sketches to sculpt or extend the model.', 'sculpt.gif'],
- ['Export your design to a 3D printer and turn into reality.', ''],
+ ['Export your design to a 3D printer and turn into reality.', '3dprint.mp4'],
]
@@ -87,7 +87,7 @@ const arr = [
-export const Help = ({ setModal }) => {
+export const Help = ({ setModal, setQs }) => {
@@ -150,38 +150,53 @@ export const Help = ({ setModal }) => {
{
arr.map(
- (e, idx) =>
-

+ (e, idx) => {
+ const isVideo = e[1].match(/\.[0-9a-z]+$/i)[0] == '.mp4'
+ return
+ {
+ isVideo ?
+
+ :
+

+ }
-
-
+
+ }
)
}
-
-
+
*/}
@@ -192,7 +207,10 @@ export const Help = ({ setModal }) => {
// style={{
// position:'absolute'
// bottom: 0.1 * state.rect}}
- onClick={() => setModal(false)}
+ onClick={() => {
+ setModal(false)
+ setQs(true)
+ }}
>
Get Started
@@ -208,14 +226,14 @@ export const Help = ({ setModal }) => {
carouselDispatch({ type: "move", del: 1 })}
style={{
- visibility: state.pg == arr.length ? 'hidden' : 'visible'
+ visibility: state.pg == arr.length - 1 ? 'hidden' : 'visible'
}}
>
- {Array(arr.length + 1).fill().map((ele, idx) => (
+ {Array(arr.length).fill().map((ele, idx) => (
))}
diff --git a/src/react/modal.jsx b/src/react/modal.jsx
index 13531fb..2f7c326 100644
--- a/src/react/modal.jsx
+++ b/src/react/modal.jsx
@@ -12,12 +12,11 @@ export class Modal extends React.Component {
this.handleClickout = this.handleClickout.bind(this)
+ this.clickOut = props.clickOut == undefined ? true : props.clickOut
}
handleClickout(e) {
- if (modalRoot.lastChild != this.el ) return
-
- console.log(this.id, e.composedPath())
+ if (modalRoot.lastChild != this.el) return
if (!e.composedPath().includes(this.el)) {
@@ -28,12 +27,13 @@ export class Modal extends React.Component {
componentDidMount() {
modalRoot.appendChild(this.el);
-
- document.addEventListener( // handles click outside buttona & dropdown
- 'click', this.handleClickout
- ,
- { capture: true } // capture phase to allow for stopPropogation on others
- )
+ if (this.clickOut) {
+ document.addEventListener( // handles click outside buttona & dropdown
+ 'click', this.handleClickout
+ ,
+ { capture: true } // capture phase to allow for stopPropogation on others
+ )
+ }
}
componentWillUnmount() {
diff --git a/src/react/navBar.jsx b/src/react/navBar.jsx
index ad55fab..956a471 100644
--- a/src/react/navBar.jsx
+++ b/src/react/navBar.jsx
@@ -12,7 +12,8 @@ import { Dialog } from './dialog'
import { Modal } from './modal'
import { STLExport, saveFile, openFile } from './fileHelpers'
import { QuickStart } from './quickStart';
-
+import { Help } from './help'
+const visitedFlagStorage = sessionStorage
const buttonIdx = {
'line': 1,
'arc': 2,
@@ -170,9 +171,10 @@ export const NavBar = () => {
const [_, forceUpdate] = useReducer(x => x + 1, 0);
+ const [splash, setSplash] = useState(!visitedFlagStorage.getItem('visited'))
const [modal, setModal] = useState(false)
- return
+ return
@@ -187,8 +189,8 @@ export const NavBar = () => {
{(sketchActive ? sketchModeButtons : partModeButtons).map(
([Icon, fcn, txt], idx) => (
Icon !== undefined ?
-
:
@@ -197,23 +199,27 @@ export const NavBar = () => {
-
{
+ {
setModal(true)
}
} />
-
-
+
+
-
-
+
+
{
- modal &&
-
-
-
+ splash &&
+
+
+ }
+ {
+ modal &&
+
}
@@ -222,29 +228,4 @@ export const NavBar = () => {
-export const QuickStartWrapper = ({ children }) => {
- const [rect, setRect] = useState(Math.min(Math.min(window.innerHeight * 0.8, window.innerWidth * 0.7), 800))
-
- const updateSize = () => {
- setRect(Math.min(Math.min(window.innerHeight * 0.8, window.innerWidth * 0.7), 800))
- }
- useEffect(() => {
- window.addEventListener('resize', updateSize)
- return () => {
- window.removeEventListener('resize', updateSize)
- }
- }, [])
-
- return
- {children}
-
-}
-
-
diff --git a/src/react/quickStart.jsx b/src/react/quickStart.jsx
index e2774e1..4b6d4c1 100644
--- a/src/react/quickStart.jsx
+++ b/src/react/quickStart.jsx
@@ -4,7 +4,7 @@ import { useDispatch, useSelector } from "react-redux"
import { Clip } from './clip'
import { Modal } from './modal'
-import { MdZoomIn, MdSave, MdFolder, MdInsertDriveFile, MdHelpOutline } from 'react-icons/md'
+import { MdZoomIn, MdSave, MdFolder, MdInsertDriveFile, MdCancel } from 'react-icons/md'
import { FaRegPlayCircle, FaEdit, FaCubes } from 'react-icons/fa'
import * as Icon from "./icons";
@@ -50,36 +50,48 @@ const clipArr = [
['basic-workflow.mp4', 'Basic model creation workflow'],
['load-file-and-edit.mp4', 'Loading and editing models'],
['export-to-3dprint.mp4', 'Exporting model for 3D printing'],
- ['headphones-stand.json.gz', 'Headphones Stand Model'],
+ ['headphone-stand.json.gz', 'Headphone Stand Model'],
]
const utf8decoder = new TextDecoder();
-export const QuickStart = ({setModal}) => {
+export const QuickStart = ({ setModal }) => {
const dispatch = useDispatch()
const [clip, setClip] = useState(null)
+ const [rect, setRect] = useState(Math.min(Math.min(window.innerHeight * 0.8, window.innerWidth * 0.7), 800))
- return
-
-
- Quick Start
-
+ const updateSize = () => {
+ setRect(Math.min(Math.min(window.innerHeight * 0.8, window.innerWidth * 0.7), 800))
+ }
+ useEffect(() => {
+ window.addEventListener('resize', updateSize)
+ return () => {
+ window.removeEventListener('resize', updateSize)
+ }
+ }, [])
+ return
+
-
+
Demos
-
+
{
clipArr.map((ele, idx) => {
const isGz = ele[0].match(/\.[0-9a-z]+$/i)[0] == '.gz'
- return
{
if (isGz) {
const state = sce.loadState(
@@ -95,9 +107,9 @@ export const QuickStart = ({setModal}) => {
).decompress()
)
)
-
+
setModal(false)
- dispatch({ type: 'restore-state', state, fileName: ele[0] })
+ dispatch({ type: 'restore-state', state, fileName: ele[0].replace(/\.[^/.]+$/, "") })
sce.render()
} else {
@@ -109,9 +121,9 @@ export const QuickStart = ({setModal}) => {
key={idx}
>
{isGz ?
-
+
:
-
+
}
{ele[1]}
@@ -130,7 +142,7 @@ export const QuickStart = ({setModal}) => {
{
navArr.map((row, i) => (
typeof row === 'string' ?
-
+
{row}
:
@@ -161,18 +173,27 @@ export const QuickStart = ({setModal}) => {
}
-
-
-
- {
- clip &&
-
-
- }
+
+
+ Quick Start
+
+
setModal(null)}
+ />
+
+
+
+
+
+ {
+ clip &&
+
+
+ }
+
-
}
\ No newline at end of file