diff options
| author | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2020-08-03 22:19:32 +0800 |
|---|---|---|
| committer | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2020-08-03 22:19:32 +0800 |
| commit | c796c665f53a34d09caaa5edcbd3e2e2649616fe (patch) | |
| tree | 2c685c46551e7d2fe1560ef34540dfdc5a80172d /src/client/views/presentationview/PresElementBox.tsx | |
| parent | 8303cd6389fe9e3c861d7b429bb4e32d3417a895 (diff) | |
| parent | 3e5de053421b29315c57bde165a798bee3ed077b (diff) | |
updated UI to fit with menu redesign
Diffstat (limited to 'src/client/views/presentationview/PresElementBox.tsx')
| -rw-r--r-- | src/client/views/presentationview/PresElementBox.tsx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx index a27d5ef16..0e245cf02 100644 --- a/src/client/views/presentationview/PresElementBox.tsx +++ b/src/client/views/presentationview/PresElementBox.tsx @@ -231,6 +231,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc } private _itemRef: React.RefObject<HTMLDivElement> = React.createRef(); + private _dragRef: React.RefObject<HTMLDivElement> = React.createRef(); headerDown = (e: React.PointerEvent<HTMLDivElement>) => { const element = document.elementFromPoint(e.clientX, e.clientY)?.parentElement; @@ -251,7 +252,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc // let value = this.getValue(this._heading); // value = typeof value === "string" ? `"${value}"` : value; if (activeItem) { - DragManager.StartDocumentDrag(PresBox.Instance._eleArray.map(ele => ele), dragData, e.clientX, e.clientY); + DragManager.StartDocumentDrag(PresBox.Instance._dragArray.map(ele => ele), dragData, e.clientX, e.clientY); activeItem.dragging = true; return true; } @@ -269,15 +270,19 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc ref={this._itemRef} style={{ outlineWidth: Doc.IsBrushed(this.targetDoc) ? `1px` : "0px", }} onClick={e => { + e.stopPropagation(); + e.preventDefault(); if (e.ctrlKey || e.metaKey) { - PresBox.Instance.multiSelect(this.rootDoc, this._itemRef.current!); + PresBox.Instance.multiSelect(this.rootDoc, this._itemRef.current!, this._dragRef.current!); console.log("cmmd click"); } else if (e.shiftKey) { - PresBox.Instance.shiftSelect(this.rootDoc, this._itemRef.current!); + PresBox.Instance.shiftSelect(this.rootDoc, this._itemRef.current!, , this._dragRef.current!); } else { - this.props.focus(this.rootDoc); e.stopPropagation(); + this.props.focus(this.rootDoc); PresBox.Instance._eleArray = []; PresBox.Instance._eleArray.push(this._itemRef.current!); + PresBox.Instance._dragArray = []; + PresBox.Instance._dragArray.push(this._dragRef.current!); console.log("normal click"); } }} @@ -290,7 +295,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc onPointerDown={this.headerDown} > <> - <div className="presElementBox-number"> + <div ref={this._dragRef} className="presElementBox-number"> {`${this.indexInPres + 1}.`} </div> <div className="presElementBox-name"> |
