diff --git a/.vscode/launch.json b/.vscode/launch.json index 05aeb5f94..55a1f80cf 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -52,6 +52,16 @@ "/": "${workspaceFolder}/online/src" } }, + { + "name": "classic w/design", + + "type": "chrome", + "request": "launch", + "url": "http://localhost:8532/classic/index.html?design=//raw.githubusercontent.com/vorth/vzome-sharing/main/2021/09/11/10-10-11-rose-olive-bombshell-solid/rose-olive-bombshell-solid.vZome", + "pathMapping": { + "/": "${workspaceFolder}/online/src" + } + }, { "name": "classic PWA", diff --git a/online/build.gradle b/online/build.gradle index a1fb4c5b5..59508b523 100644 --- a/online/build.gradle +++ b/online/build.gradle @@ -229,7 +229,7 @@ core.config { 'com/vzome/core/edits/RunZomodScript.java', 'com/vzome/core/edits/RunPythonScript.java', 'com/vzome/core/edits/RealizeMetaParts.java', - 'com/vzome/core/edits/ReplaceWithShape.java', + // 'com/vzome/core/edits/ReplaceWithShape.java', 'com/vzome/core/exporters/ColoredMeshJsonExporter.java', 'com/vzome/core/exporters/SimpleMeshJsonExporter.java', diff --git a/online/src/app/browser/browser.jsx b/online/src/app/browser/browser.jsx index f35546b21..9d08deb03 100644 --- a/online/src/app/browser/browser.jsx +++ b/online/src/app/browser/browser.jsx @@ -39,6 +39,8 @@ const DesignList = (props) => ); } +const classicURL = new URL( '../classic/index.html', window.location ) .toString() + "?design="; + const DesignActions = (props) => { const copyHtml = path => @@ -76,6 +78,9 @@ const DesignActions = (props) => + ); diff --git a/online/src/app/classic/menus/contextmenu.jsx b/online/src/app/classic/menus/contextmenu.jsx index ccb145b19..56e7869d6 100644 --- a/online/src/app/classic/menus/contextmenu.jsx +++ b/online/src/app/classic/menus/contextmenu.jsx @@ -20,6 +20,8 @@ export const ContextualMenu = props => return state.picked?.type && state.picked.type !== 'ball'; case 'panel': return state.picked?.type === null; + case 'ballOrStrut': + return state.picked?.type !== null; default: return true; } @@ -99,7 +101,7 @@ export const ContextualMenu = props => - + @@ -110,7 +112,7 @@ export const ContextualMenu = props => } */} - + {/* // this .add( enabler .setMenuAction( "showProperties-"+key, this .controller, new JMenuItem( "Show Properties" ) ) ); */} diff --git a/online/src/app/classic/menus/filemenu.jsx b/online/src/app/classic/menus/filemenu.jsx index 00085102b..c2e31d91f 100644 --- a/online/src/app/classic/menus/filemenu.jsx +++ b/online/src/app/classic/menus/filemenu.jsx @@ -1,5 +1,5 @@ -import { createEffect, createSignal, mergeProps } from "solid-js"; +import { createEffect, createSignal, mergeProps, onMount } from "solid-js"; import { unwrap } from "solid-js/store"; import { controllerExportAction, controllerProperty, useEditor } from "../../../viewer/context/editor.jsx"; @@ -11,6 +11,12 @@ import { UrlDialog } from '../dialogs/webloader.jsx' import { SvgPreviewDialog } from "../dialogs/svgpreview.jsx"; import { useCamera } from "../../../viewer/context/camera.jsx"; +const queryParams = new URLSearchParams( window.location.search ); +const relativeUrl = queryParams.get( 'design' ); + +// Must make this absolute before the worker tries to, with the wrong base URL +const url = ( relativeUrl && new URL( relativeUrl, window.location ) .toString() ); + const NewDesignItem = props => { const { rootController } = useEditor(); @@ -83,6 +89,9 @@ export const FileMenu = () => } } + // Open the design indicated in the query string, if any + onMount( () => url && openUrl( url ) ); + const [ svgPreview, setSvgPreview ] = createSignal( false ); const exportAs = ( extension, mimeType, format=extension ) => evt => diff --git a/online/src/app/classic/menus/toolsmenu.jsx b/online/src/app/classic/menus/toolsmenu.jsx index 50e8ecc56..d9882cfad 100644 --- a/online/src/app/classic/menus/toolsmenu.jsx +++ b/online/src/app/classic/menus/toolsmenu.jsx @@ -39,7 +39,7 @@ export const ToolsMenu = () => - + diff --git a/online/src/viewer/export.jsx b/online/src/viewer/export.jsx index d2aed3075..2978e8c75 100644 --- a/online/src/viewer/export.jsx +++ b/online/src/viewer/export.jsx @@ -1,10 +1,12 @@ -import { DropdownMenu } from "@kobalte/core"; +import { DropdownMenu, Link } from "@kobalte/core"; import { useViewer } from "./context/viewer.jsx"; import { saveFileAs } from "../viewer/util/files.js"; import { useGltfExporter } from "./geometry.jsx"; +const editUrlBase = 'https://vzome.com/app/classic/index.html?design='; + export const ExportMenu = (props) => { const { source } = useViewer(); @@ -42,6 +44,11 @@ export const ExportMenu = (props) => + + + Open in vZome Online + + .vZome source diff --git a/online/src/viewer/index.jsx b/online/src/viewer/index.jsx index c4333c1c3..9093a16f0 100644 --- a/online/src/viewer/index.jsx +++ b/online/src/viewer/index.jsx @@ -133,7 +133,7 @@ const UrlViewer = (props) => return ( - + diff --git a/online/src/worker/legacy/controllers/editor.js b/online/src/worker/legacy/controllers/editor.js index fe2590b41..647259429 100644 --- a/online/src/worker/legacy/controllers/editor.js +++ b/online/src/worker/legacy/controllers/editor.js @@ -176,6 +176,18 @@ export class EditorController extends com.vzome.desktop.controller.DefaultContro break; } + case "setBuildOrbitAndLength": { + const { picked } = params.getConfig(); + const rm = picked .getRenderedObject(); + const length = rm .getStrutLength(); + const orbit = rm .getStrutOrbit(); + this.symmController .availableController .doAction( "enableDirection." + orbit .getName() ); + this.symmController .buildController .doAction( "setSingleDirection." + orbit .getName() ); + const lmodel = this.symmController .buildController .getSubController( "currentLength" ); + lmodel .setActualLength( length ); + break; + } + case "exportText": const { format, selection, camera, lighting, height=500, width=800, useShapes=true, drawOutlines=true, monochrome=false, showBackground=true, useLighting=true } = params.getConfig();