diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-10-19 00:59:06 +0530 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-10-19 00:59:06 +0530 |
commit | 5df1acbe0f5ce9fe00868e724f5c30fd9775c4bd (patch) | |
tree | 16918105f01093e26a9472430a9966e16a81e55a /src/client/views/presentationview/PresElementBox.tsx | |
parent | cf1d27d35864915ea67050297e1c888aa0f81709 (diff) | |
parent | 37fc6beb4662be195b8aa551cc1042b04f2c24a8 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into restored_server_monitor
Diffstat (limited to 'src/client/views/presentationview/PresElementBox.tsx')
-rw-r--r-- | src/client/views/presentationview/PresElementBox.tsx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx index ab4cadab0..aea00f812 100644 --- a/src/client/views/presentationview/PresElementBox.tsx +++ b/src/client/views/presentationview/PresElementBox.tsx @@ -20,6 +20,8 @@ import { DragManager } from "../../util/DragManager"; import { CurrentUserUtils } from "../../util/CurrentUserUtils"; import { undoBatch } from "../../util/UndoManager"; import { EditableView } from "../EditableView"; +import { DocUtils } from "../../documents/Documents"; +import { DateField } from "../../../fields/DateField"; export const presSchema = createSchema({ presentationTargetDoc: Doc, @@ -175,8 +177,9 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc doc.className = "presItem-slide"; dragItem.push(doc); }); + const dropEvent = () => runInAction(() => this._dragging = false); if (activeItem) { - DragManager.StartDocumentDrag(dragItem.map(ele => ele), dragData, e.clientX, e.clientY); + DragManager.StartDocumentDrag(dragItem.map(ele => ele), dragData, e.clientX, e.clientY, undefined, dropEvent); runInAction(() => this._dragging = true); return true; } @@ -242,13 +245,22 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc PresBox.Instance._dragArray.push(this._dragRef.current!); } + /** + * Method called for updating the view of the currently selected document + * + * @param targetDoc + * @param activeItem + */ @undoBatch @action - pinWithView = (targetDoc: Doc, activeItem: Doc) => { + updateView = (targetDoc: Doc, activeItem: Doc) => { console.log(targetDoc.type); if (targetDoc.type === DocumentType.PDF || targetDoc.type === DocumentType.WEB || targetDoc.type === DocumentType.RTF) { const scroll = targetDoc._scrollTop; activeItem.presPinViewScroll = scroll; + } else if (targetDoc.type === DocumentType.COMPARISON) { + const clipWidth = targetDoc._clipWidth; + activeItem.presPinClipWidth = clipWidth; } else { const x = targetDoc._panX; const y = targetDoc._panY; @@ -316,7 +328,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc <div className={"presItem-slideButtons"}> <Tooltip title={<><div className="dash-tooltip">{"Update view"}</div></>}> <div className="slideButton" - onClick={() => this.pinWithView(targetDoc, activeItem)} + onClick={() => this.updateView(targetDoc, activeItem)} style={{ fontWeight: 700, display: activeItem.presPinView ? "flex" : "none" }}>V</div> </Tooltip> <Tooltip title={<><div className="dash-tooltip">{this.rootDoc.presExpandInlineButton ? "Minimize" : "Expand"}</div></>}><div className={"slideButton"} onClick={e => { e.stopPropagation(); this.presExpandDocumentClick(); }}> |