diff --git a/packages/designer/src/builtins/drag-ghost/ghost.tsx b/packages/designer/src/builtins/drag-ghost/ghost.tsx deleted file mode 100644 index 972516abe..000000000 --- a/packages/designer/src/builtins/drag-ghost/ghost.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import { Component } from 'react'; -import { observer, obx } from '@ali/recore'; -import { dragon } from '../../globals/dragon'; - -import './ghost.less'; -import { OutlineBoardID } from '../builtin-panes/outline-pane/outline-board'; -// import { INode } from '../../document/node'; - -type offBinding = () => any; - -@observer -export default class Ghost extends Component { - private dispose: offBinding[] = []; - @obx.ref private dragment: any = null; - @obx.ref private x = 0; - @obx.ref private y = 0; - - componentWillMount() { - this.dispose = [ - dragon.onDragstart(e => { - this.dragment = e.dragTarget; - this.x = e.clientX; - this.y = e.clientY; - }), - dragon.onDrag(e => { - this.x = e.clientX; - this.y = e.clientY; - }), - dragon.onDragend(() => { - this.dragment = null; - this.x = 0; - this.y = 0; - }), - ]; - } - - shouldComponentUpdate() { - return false; - } - - componentWillUnmount() { - if (this.dispose) { - this.dispose.forEach(off => off()); - } - } - - renderGhostGroup() { - const dragment = this.dragment; - if (Array.isArray(dragment)) { - return dragment.map((node: any, index: number) => { - const ghost = ( -
-
{node.tagName}
-
- ); - return ghost; - }); - } else { - return ( -
-
{dragment.tagName}
-
- ); - } - } - - render() { - if (!this.dragment) { - return null; - } - - // let x = this.x; - // let y = this.y; - - // todo: 考虑多个图标、title、不同 sensor 区域的形态 - if (dragon.activeSensor && dragon.activeSensor.id === OutlineBoardID) { - // const nodeId = (this.dragment as INode).id; - // const elt = document.querySelector(`[data-id="${nodeId}"`) as HTMLDivElement; - // - // if (elt) { - // // do something - // // const target = elt.cloneNode(true) as HTMLDivElement; - // console.log('>>> target', elt); - // elt.classList.remove('hidden'); - // elt.classList.add('dragging'); - // elt.style.transform = `translate(${this.x}px, ${this.y}px)`; - // } - // - // return null; - // x -= 30; - // y += 30; - } - - return ( -
- {this.renderGhostGroup()} -
- ); - } -} diff --git a/packages/designer/src/designer/canvas.less b/packages/designer/src/designer/canvas.less deleted file mode 100644 index cfc57d730..000000000 --- a/packages/designer/src/designer/canvas.less +++ /dev/null @@ -1,47 +0,0 @@ -.my-canvas { - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - margin: 10px; - box-shadow: 0 2px 10px 0 rgba(31,56,88,.15); -} - -html.my-show-topbar .my-canvas { - top: var(--topbar-height); -} -html.my-show-toolbar .my-canvas { - top: var(--toolbar-height); -} -html.my-show-topbar.my-show-toolbar .my-canvas { - top: calc(var(--topbar-height) + var(--topbar-height)); -} - -.my-screen { - top: 0; - bottom: 0; - width: 100%; - left: 0; - position: absolute; - overflow: hidden; -} - -.my-doc-shell { - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: 100%; - overflow: hidden; - .my-doc-frame { - border: none; - transform-origin: 0 0; - height: 100%; - width: 100%; - } -} - -.my-drag-pane-mode .my-doc-shell { - pointer-events: none; -} diff --git a/packages/designer/src/designer/canvas.tsx b/packages/designer/src/designer/canvas.tsx deleted file mode 100644 index 3a6daadf3..000000000 --- a/packages/designer/src/designer/canvas.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import { Component } from 'react'; -import { observer } from '@ali/recore'; -import { getCurrentDocument, screen, progressing } from '../../globals'; -import { AutoFit } from '../../document/viewport'; -import { AuxiliaryView } from '../auxiliary'; -import { PreLoaderView } from '../widgets/pre-loader'; -import DocumentContext from '../../document/document-context'; -import FocusingArea from '../widgets/focusing-area'; -import './canvas.less'; - -const Canvas = () => ( - { - const doc = getCurrentDocument(); - if (doc) { - doc.selection.clear(); - } - return false; - }} - > - - -); - -export default Canvas; - -@observer -class Screen extends Component { - render() { - const doc = getCurrentDocument(); - // TODO: thinkof multi documents - return ( -
screen.mount(elmt)} className="my-screen"> - {progressing.visible ? : null} - - {doc ? : null} -
- ); - } -} - -@observer -class DocumentView extends Component<{ doc: DocumentContext }> { - componentWillUnmount() { - this.props.doc.sleep(); - } - - render() { - const { doc } = this.props; - const viewport = doc.viewport; - let shellStyle = {}; - let frameStyle = {}; - if (viewport.width !== AutoFit && viewport.height !== AutoFit) { - const shellWidth = viewport.width * viewport.scale; - const screenWidth = screen.width; - const shellLeft = shellWidth < screenWidth ? `calc((100% - ${shellWidth}px) / 2)` : 0; - shellStyle = { - width: shellWidth, - left: shellLeft, - }; - frameStyle = { - transform: `scale(${viewport.scale})`, - height: viewport.height, - width: viewport.width, - }; - } - - return ( -
-