From 474f117df2551ff5d3be83d6cc92c34644a6fbed Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Thu, 15 Oct 2020 10:24:17 +0800 Subject: fixed changing transition undo bug :unlock: #864 --- src/client/views/nodes/PresBox.scss | 49 +++++++++++++++++ src/client/views/nodes/PresBox.tsx | 105 ++++++++++++++++++++++++++---------- 2 files changed, 126 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PresBox.scss b/src/client/views/nodes/PresBox.scss index ad2e7122f..033e1e030 100644 --- a/src/client/views/nodes/PresBox.scss +++ b/src/client/views/nodes/PresBox.scss @@ -411,6 +411,53 @@ $light-background: #ececec; transform: scale(1.05); transition: all 0.4s; } + + .ribbon-frameList { + width: calc(100% - 5px); + height: 50px; + background-color: #ececec; + border: 1px solid #9f9f9f; + grid-template-rows: max-content; + + .frameList-header { + display: grid; + width: 100%; + height: 20px; + background-color: #9f9f9f; + + .frameList-headerButtons { + display: flex; + grid-column: 7; + width: 60px; + justify-self: right; + justify-content: flex-end; + + .headerButton { + cursor: pointer; + position: relative; + border-radius: 100%; + z-index: 300; + width: 15px; + height: 15px; + display: flex; + font-size: 10px; + justify-self: center; + align-self: center; + background-color: rgba(0, 0, 0, 0.5); + color: white; + justify-content: center; + align-items: center; + transition: 0.2s; + margin-right: 3px; + } + + .headerButton:hover { + background-color: rgba(0, 0, 0, 1); + transform: scale(1.15); + } + } + } + } } .selectedList { @@ -1007,6 +1054,8 @@ $light-background: #ececec; .presPanel-button-text:hover { background-color: #5a5a5a; } + + } // .miniPres { diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 8e2884968..dd7eba0b2 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -821,6 +821,7 @@ export class PresBox extends ViewBoxBaseComponent } // Converts seconds to ms and updates presTransition + @undoBatch setTransitionTime = (number: String, change?: number) => { let timeInMS = Number(number) * 1000; if (change) timeInMS += change; @@ -830,6 +831,7 @@ export class PresBox extends ViewBoxBaseComponent } // Converts seconds to ms and updates presDuration + @undoBatch setDurationTime = (number: String, change?: number) => { let timeInMS = Number(number) * 1000; if (change) timeInMS += change; @@ -1250,10 +1252,10 @@ export class PresBox extends ViewBoxBaseComponent const currentFrame = Cast(tagDoc._currentFrame, "number", null); if (currentFrame === undefined) { tagDoc._currentFrame = 0; - CollectionFreeFormDocumentView.setupScroll(tagDoc, 0); - CollectionFreeFormDocumentView.setupKeyframes(childDocs, 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)); @@ -1266,7 +1268,7 @@ export class PresBox extends ViewBoxBaseComponent const currentFrame = Cast(tagDoc._currentFrame, "number", null); if (currentFrame === undefined) { tagDoc._currentFrame = 0; - CollectionFreeFormDocumentView.setupKeyframes(childDocs, 0); + // CollectionFreeFormDocumentView.setupKeyframes(childDocs, 0); } CollectionFreeFormDocumentView.gotoKeyframe(childDocs.slice()); tagDoc._currentFrame = Math.max(0, (currentFrame || 0) - 1); @@ -1308,13 +1310,13 @@ export class PresBox extends ViewBoxBaseComponent return (
e.stopPropagation()} onPointerUp={e => e.stopPropagation()} onPointerDown={e => e.stopPropagation()}> -
+ {/*
{this.stringType} selected
Contents
Edit
- {/*
+
Active text color
{ this.openActiveColorPicker = !this.openActiveColorPicker; })}>
@@ -1325,17 +1327,17 @@ export class PresBox extends ViewBoxBaseComponent
this.openViewedColorPicker = !this.openViewedColorPicker)}>
- {this.viewedColorPicker} */} - {/*
+ {this.viewedColorPicker} +
Zoom
Edit
-
*/} +
Scroll
Edit
-
-
+
*/} +
Frames
@@ -1353,12 +1355,8 @@ export class PresBox extends ViewBoxBaseComponent
{"Last frame"}
}>
{NumCast(targetDoc.lastFrame)}
-
- -
-
- {this.frameList} -
+ {this.frameListHeader} + {this.frameList}
console.log(" TODO: play frames")}>Play
@@ -1462,7 +1460,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; @@ -1723,19 +1721,70 @@ export class PresBox extends ViewBoxBaseComponent ); } - @computed get frameList() { + @action + getList = (list: any): List => { + const x: List = list; + return x; + } + + @action + updateList = (list: any): List => { + const targetDoc: Doc = this.targetDoc; + const x: List = list; + x.length + 1; + x[x.length - 1] = NumCast(targetDoc._scrollY); + return x; + } + + @action + newFrame = () => { const activeItem: Doc = this.activeItem; const targetDoc: Doc = this.targetDoc; - const frameList: number[] = []; - frameList.length = NumCast(targetDoc.lastFrame); - const frameItems = frameList.map((value) => { -
+ const type: string = StrCast(targetDoc.type); + if (!activeItem.frameList) activeItem.frameList = new List(); + switch (type) { + case (DocumentType.PDF || DocumentType.RTF || DocumentType.WEB): + this.updateList(activeItem.frameList); + break; + case DocumentType.COL: + break; + default: + break; + } + } + @computed get frameListHeader() { + return (
+ Frames +
+
{"Add frame by example"}
}>
{ e.stopPropagation(); this.newFrame(); }}> + e.stopPropagation()} /> +
+
{"Edit in collection"}
}>
{ e.stopPropagation(); console.log('New frame'); }}> + e.stopPropagation()} /> +
- }) - return
- {frameItems} -
; +
); + } + + @computed get frameList() { + const activeItem: Doc = this.activeItem; + const targetDoc: Doc = this.targetDoc; + const frameList: List = this.getList(activeItem.frameList); + if (frameList) { + const frameItems = frameList.map((value) => +
+ +
+ ); + return ( + +
+ {frameItems} +
+ ); + } else return (null); + } @computed get playButtonFrames() { @@ -1798,7 +1847,7 @@ export class PresBox extends ViewBoxBaseComponent {this.playButtonFrames}
-
EXIT
+
{ this.updateMinimize; this.layoutDoc.presStatus = "edit"; clearTimeout(this._presTimer); }}>EXIT
: -- cgit v1.2.3-70-g09d2