From 80ccba05db32ca09ac513f3ec370f3deef873ce7 Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Wed, 14 Oct 2020 02:45:39 +0800 Subject: update view (as button), doc.dragging q? --- .../views/collections/CollectionStackingView.tsx | 4 +-- src/client/views/nodes/PresBox.tsx | 33 ++++++++++++++--- .../views/presentationview/PresElementBox.tsx | 42 ++++++++++++++++------ 3 files changed, 61 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx index d41e0528d..3607b97d0 100644 --- a/src/client/views/collections/CollectionStackingView.tsx +++ b/src/client/views/collections/CollectionStackingView.tsx @@ -295,7 +295,7 @@ export class CollectionStackingView extends CollectionSubView { if (i === 0) { - doc.dragging = false; + if (doc.presentationTargetDoc) doc.dragging = false; //glr: so it only applies to items in presentation DragManager.docsBeingDragged = []; if (targInd === -1) targInd = docs.length; else targInd = docs.indexOf(this.filteredChildren[targInd]); @@ -303,7 +303,7 @@ export class CollectionStackingView extends CollectionSubView srcInd ? targInd - 1 : targInd) + plusOne, 0, doc); } else if (i < (newDocs.length / 2)) { //glr: for some reason dragged documents are duplicated - doc.dragging = false; + if (doc.presentationTargetDoc) doc.dragging = false; DragManager.docsBeingDragged = []; if (targInd === -1) targInd = docs.length; else targInd = docs.indexOf(newDocs[0]) + 1; diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 1a16e6237..8e2884968 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -1250,10 +1250,10 @@ export class PresBox extends ViewBoxBaseComponent const currentFrame = Cast(tagDoc._currentFrame, "number", null); if (currentFrame === undefined) { tagDoc._currentFrame = 0; - // CollectionFreeFormDocumentView.setupScroll(tagDoc, 0); + CollectionFreeFormDocumentView.setupScroll(tagDoc, 0); CollectionFreeFormDocumentView.setupKeyframes(childDocs, 0); } - // if (tagDoc.editScrollProgressivize) CollectionFreeFormDocumentView.updateScrollframe(tagDoc, currentFrame); + if (tagDoc.editScrollProgressivize) CollectionFreeFormDocumentView.updateScrollframe(tagDoc, currentFrame); CollectionFreeFormDocumentView.updateKeyframe(childDocs, currentFrame || 0, tagDoc); tagDoc._currentFrame = Math.max(0, (currentFrame || 0) + 1); tagDoc.lastFrame = Math.max(NumCast(tagDoc._currentFrame), NumCast(tagDoc.lastFrame)); @@ -1314,7 +1314,7 @@ export class PresBox extends ViewBoxBaseComponent
Contents
Edit
-
+ {/*
Active text color
{ this.openActiveColorPicker = !this.openActiveColorPicker; })}>
@@ -1325,7 +1325,7 @@ export class PresBox extends ViewBoxBaseComponent
this.openViewedColorPicker = !this.openViewedColorPicker)}>
- {this.viewedColorPicker} + {this.viewedColorPicker} */} {/*
Zoom
Edit
@@ -1352,6 +1352,14 @@ export class PresBox extends ViewBoxBaseComponent
{"Last frame"}
}>
{NumCast(targetDoc.lastFrame)}
+
+
+ +
+
+ {this.frameList} +
+
console.log(" TODO: play frames")}>Play
@@ -1454,7 +1462,7 @@ export class PresBox extends ViewBoxBaseComponent activeItem.scrollProgressivize = !activeItem.scrollProgressivize; const targetDoc: Doc = this.targetDoc; targetDoc.scrollProgressivize = !targetDoc.scrollProgressivize; - // CollectionFreeFormDocumentView.setupScroll(targetDoc, NumCast(targetDoc._currentFrame)); + CollectionFreeFormDocumentView.setupScroll(targetDoc, NumCast(targetDoc._currentFrame)); if (targetDoc.editScrollProgressivize) { targetDoc.editScrollProgressivize = false; targetDoc._currentFrame = 0; @@ -1715,6 +1723,21 @@ export class PresBox extends ViewBoxBaseComponent ); } + @computed get frameList() { + const activeItem: Doc = this.activeItem; + const targetDoc: Doc = this.targetDoc; + const frameList: number[] = []; + frameList.length = NumCast(targetDoc.lastFrame); + const frameItems = frameList.map((value) => { +
+ +
+ }) + return
+ {frameItems} +
; + } + @computed get playButtonFrames() { const targetDoc: Doc = this.targetDoc; return ( diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx index b1eac5832..367bc6533 100644 --- a/src/client/views/presentationview/PresElementBox.tsx +++ b/src/client/views/presentationview/PresElementBox.tsx @@ -71,10 +71,10 @@ export class PresElementBox extends ViewBoxBaseComponent 97; + embedHeight = (): number => 97; // embedWidth = () => this.props.PanelWidth(); // embedHeight = () => Math.min(this.props.PanelWidth() - 20, this.props.PanelHeight() - this.collapsedHeight); - embedWidth = () => this.props.PanelWidth() - 30; + embedWidth = (): number => this.props.PanelWidth() - 30; /** * The function that is responsible for rendering a preview or not for this * presentation element. @@ -155,7 +155,14 @@ export class PresElementBox extends ViewBoxBaseComponent) => { + e.stopPropagation(); + e.preventDefault(); + } + + stopDrag = (e: PointerEvent) => { + console.log('stop drag') const activeItem = this.rootDoc; + activeItem.dragging = false; e.stopPropagation(); e.preventDefault(); } @@ -184,7 +191,7 @@ export class PresElementBox extends ViewBoxBaseComponent { const slide = this._itemRef.current!; - const rect = slide!.getBoundingClientRect(); + const rect = slide?.getBoundingClientRect(); let y = e.clientY - rect.top; //y position within the element. let height = slide.clientHeight; let halfLine = height / 2; @@ -201,9 +208,8 @@ export class PresElementBox extends ViewBoxBaseComponent { - console.log('pointerLeave'); - this._itemRef.current!.style.borderTop = "0px" - this._itemRef.current!.style.borderBottom = "0px" + this._itemRef.current!.style.borderTop = "0px"; + this._itemRef.current!.style.borderBottom = "0px"; document.removeEventListener("pointermove", this.onPointerMove); } @@ -240,6 +246,10 @@ export class PresElementBox extends ViewBoxBaseComponent= 300; + const targetDoc: Doc = Cast(this.rootDoc.presentationTargetDoc, Doc, null); + const activeItem: Doc = this.rootDoc; return (
{ - console.log('double click to open'); this.toggleProperties(); this.props.focus(this.rootDoc); this.clearArrays(); @@ -274,7 +283,7 @@ export class PresElementBox extends ViewBoxBaseComponent
-
+
{isSelected ? -
{"Movement speed"}
}>
300 ? "block" : "none" }}>{this.transition}
-
{"Duration"}
}>
300 ? "block" : "none" }}>{this.duration}
-
{"Presentation pin view"}
}>
300 ? "block" : "none" }}>V
+
{"Movement speed"}
}>
{this.transition}
+
{"Duration"}
}>
{this.duration}
+
{"Update view"}
}> +
{ + const x = targetDoc._panX; + const y = targetDoc._panY; + const scale = targetDoc._viewScale; + activeItem.presPinViewX = x; + activeItem.presPinViewY = y; + activeItem.presPinViewScale = scale; + }} + style={{ fontWeight: 700, display: activeItem.presPinView ? "flex" : "none" }}>V
+
{this.rootDoc.presExpandInlineButton ? "Minimize" : "Expand"}
}>
{ e.stopPropagation(); this.presExpandDocumentClick(); }}> e.stopPropagation()} />
-- cgit v1.2.3-70-g09d2