diff --git a/modules/svg/SvgIcon.jsx b/modules/svg/SvgIcon.jsx index 7ed550be..7131a4f1 100644 --- a/modules/svg/SvgIcon.jsx +++ b/modules/svg/SvgIcon.jsx @@ -1,17 +1,9 @@ -import React, {useEffect, useMemo, useRef} from 'react'; +import React, {useMemo} from 'react'; export function SvgIcon({content, size, ...props}) { - const divEl = useRef(null); - const className = size&&'icon-'+size; - useEffect(() => { - if (divEl.current) { - divEl.current.innerHTML = content; - } - }, [divEl]); - const style = useMemo(() => { return { display: 'flex', @@ -19,7 +11,7 @@ export function SvgIcon({content, size, ...props}) { }; }, [props.style]); - return
+ return
} diff --git a/modules/ui/components/Stack.jsx b/modules/ui/components/Stack.jsx index 960abc1e..40766825 100644 --- a/modules/ui/components/Stack.jsx +++ b/modules/ui/components/Stack.jsx @@ -2,8 +2,8 @@ import React from 'react'; import ls from './Stack.less' -export default function Stack({children}) { - return
{children}
+export default function Stack(props) { + return
} diff --git a/modules/ui/components/controls/Button.jsx b/modules/ui/components/controls/Button.jsx index 813ee749..49ab419c 100644 --- a/modules/ui/components/controls/Button.jsx +++ b/modules/ui/components/controls/Button.jsx @@ -2,9 +2,9 @@ import React from 'react'; import cx from 'classnames'; -export default function Button({type, onClick, className, children}) { +export default function Button({type, onClick, className, ...props}) { - return + return
)} diff --git a/web/app/sketcher/components/SketcherActionButton.jsx b/web/app/sketcher/components/SketcherActionButton.jsx new file mode 100644 index 00000000..0fb70fe9 --- /dev/null +++ b/web/app/sketcher/components/SketcherActionButton.jsx @@ -0,0 +1,21 @@ +import {getSketcherAction} from "../actions"; +import React, {useContext} from "react"; +import {SketcherAppContext} from "./SketcherApp"; + +export function SketcherActionButton({actionId, text=false}) { + + const action = getSketcherAction(actionId); + + if (!action) { + return ?{actionId}?; + } + + const ctx = useContext(SketcherAppContext); + + const Icon = action.icon; + + return ; + +} diff --git a/web/app/sketcher/components/SketcherApp.jsx b/web/app/sketcher/components/SketcherApp.jsx index 7cab0aec..ec3d9577 100644 --- a/web/app/sketcher/components/SketcherApp.jsx +++ b/web/app/sketcher/components/SketcherApp.jsx @@ -12,6 +12,7 @@ import {Scope} from "./Scope"; import {SketcherToolbar} from "./SketcherToolbar"; import {sketcherRightToolbarConfig, sketcherTopToolbarConfig} from "../uiConfig"; import {SketchManager} from "./SketchManager"; +import {ExportDialog} from "./ExportDialog"; export const SketcherAppContext = React.createContext({}); @@ -33,7 +34,10 @@ export function SketcherApp({applicationContext}) { document.getElementById('top-toolbar') )} {ReactDOM.createPortal( - , + + + + , document.getElementById('global-windows') )} diff --git a/web/app/sketcher/components/SketcherToolbar.jsx b/web/app/sketcher/components/SketcherToolbar.jsx index 110cda82..e2e526f3 100644 --- a/web/app/sketcher/components/SketcherToolbar.jsx +++ b/web/app/sketcher/components/SketcherToolbar.jsx @@ -1,8 +1,7 @@ -import React, {useContext} from 'react'; -import {getSketcherAction} from "../actions"; -import {SketcherAppContext} from "./SketcherApp"; +import React from 'react'; import ls from './SketcherToolbar.less'; import cx from 'classnames'; +import {SketcherActionButton} from "./SketcherActionButton"; export function SketcherToolbar({actions, horizontal=false, compact}) { @@ -15,21 +14,3 @@ export function SketcherToolbar({actions, horizontal=false, compact}) { })}
; } - -export function SketcherActionButton({actionId}) { - - const action = getSketcherAction(actionId); - - if (!action) { - return ?{actionId}?; - } - - const ctx = useContext(SketcherAppContext); - - const Icon = action.icon; - - return ; - -} diff --git a/web/app/sketcher/history.js b/web/app/sketcher/history.js index a196e66e..3dcebaa4 100644 --- a/web/app/sketcher/history.js +++ b/web/app/sketcher/history.js @@ -4,7 +4,8 @@ import diff_match_patch from 'diff-match-patch'; function HistoryManager(viewer) { this.viewer = viewer; this.dmp = new diff_match_patch(); - this.init(this.viewer.io.serializeSketch()); + this.init({}); + // this.init(this.viewer.io.serializeSketch()); } HistoryManager.prototype.init = function(sketchData) { diff --git a/web/app/sketcher/sketcher-app.js b/web/app/sketcher/sketcher-app.js index 668ced61..8bf95f09 100644 --- a/web/app/sketcher/sketcher-app.js +++ b/web/app/sketcher/sketcher-app.js @@ -15,10 +15,6 @@ function App2D() { this.winManager = new ui.WinManager(); this.inputManager = new InputManager(this); - this._exportWin = new ui.Window($('#exportManager'), app.winManager); - - $('#exportManager li').click(function() {ui.closeWin(app._exportWin);}); - this.constraintFilter = {}; this.actions = {}; this.commands = {}; @@ -72,14 +68,6 @@ function App2D() { app.viewer.refresh(); }); - this.registerAction('exportSVG', "Export To SVG", function () { - IO.exportTextData(app.viewer.io.svgExport(), app.getSketchId() + ".ui.styles.init.svg"); - }); - - this.registerAction('exportDXF', "Export To DXF", function () { - IO.exportTextData(app.viewer.io.dxfExport(), app.getSketchId() + ".dxf"); - }); - this.registerAction('undo', "Undo", function () { app.viewer.historyManager.undo(); }); @@ -261,7 +249,8 @@ function createAppContext(viewer, app) { ui: { $constraintEditRequest: stream(), $wizardRequest: stream(), - $sketchManagerRequest: stream() + $sketchManagerRequest: stream(), + $exportDialogRequest: stream() } }; } diff --git a/web/css/app.less b/web/css/app.less index 31d6c9b9..44a823f8 100644 --- a/web/css/app.less +++ b/web/css/app.less @@ -80,6 +80,10 @@ html, body { padding-left: 5px; } +.dock-node { + border-bottom: 1px solid black; +} + .selected { background-color: #333; color: #ccc; @@ -190,7 +194,6 @@ html, body { } .sketcher-window { - background: #666; border: 5px solid #444444; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); } diff --git a/web/sketcher.html b/web/sketcher.html index 9ae26f44..608f13ac 100644 --- a/web/sketcher.html +++ b/web/sketcher.html @@ -17,7 +17,7 @@
-
+
@@ -32,7 +32,6 @@
-
0.000:0.000
@@ -41,22 +40,6 @@
- - -