aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-11-01 18:04:08 +0800
committerGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-11-01 18:04:08 +0800
commit6c6da53ef18ed6d28c507115571fcdb980ec260c (patch)
tree094d32c4665be2012d92acec30548dc396b30aea
parent7dc149a7ea8b988ba90f0a46466499ea46580e2e (diff)
pinWithView works with view paths
+ removed Pan options and Scroll options
-rw-r--r--src/client/views/DocumentButtonBar.tsx6
-rw-r--r--src/client/views/PropertiesView.tsx4
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.scss9
-rw-r--r--src/client/views/nodes/PresBox.tsx43
-rw-r--r--src/client/views/presentationview/PresElementBox.tsx4
5 files changed, 49 insertions, 17 deletions
diff --git a/src/client/views/DocumentButtonBar.tsx b/src/client/views/DocumentButtonBar.tsx
index 3b22cf51c..fa0b9a238 100644
--- a/src/client/views/DocumentButtonBar.tsx
+++ b/src/client/views/DocumentButtonBar.tsx
@@ -201,13 +201,15 @@ export class DocumentButtonBar extends React.Component<{ views: () => (DocumentV
if (targetDoc) {
TabDocView.PinDoc(targetDoc, false);
const activeDoc = PresBox.Instance.childDocs[PresBox.Instance.childDocs.length - 1];
- if (targetDoc.type === DocumentType.PDF || targetDoc.type === DocumentType.RTF || targetDoc.type === DocumentType.WEB || targetDoc._viewType === CollectionViewType.Stacking) {
+ const scrollable: boolean = (targetDoc.type === DocumentType.PDF || targetDoc.type === DocumentType.RTF || targetDoc.type === DocumentType.WEB || targetDoc._viewType === CollectionViewType.Stacking);
+ const pannable: boolean = ((targetDoc.type === DocumentType.COL && targetDoc._viewType === CollectionViewType.Freeform) || targetDoc.type === DocumentType.IMG);
+ if (scrollable) {
const scroll = targetDoc._scrollTop;
activeDoc.presPinView = true;
activeDoc.presPinViewScroll = scroll;
} else if (targetDoc.type === DocumentType.VID) {
activeDoc.presPinTimecode = targetDoc._currentTimecode;
- } else if ((targetDoc.type === DocumentType.COL && targetDoc._viewType === CollectionViewType.Freeform) || targetDoc.type === DocumentType.IMG) {
+ } else if (pannable) {
const x = targetDoc._panX;
const y = targetDoc._panY;
const scale = targetDoc._viewScale;
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index 4dea0ddaa..9b77e2736 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -1029,7 +1029,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
{PresBox.Instance.progressivizeDropdown}
</div> : null}
</div>} */}
- {!selectedItem || (!scrollable && !pannable) ? (null) : <div className="propertiesView-presTrails">
+ {/* {!selectedItem || (!scrollable && !pannable) ? (null) : <div className="propertiesView-presTrails">
<div className="propertiesView-presTrails-title"
onPointerDown={action(() => { this.openSlideOptions = !this.openSlideOptions; })}
style={{ backgroundColor: this.openSlideOptions ? "black" : "" }}>
@@ -1041,7 +1041,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
{this.openSlideOptions ? <div className="propertiesView-presTrails-content">
{PresBox.Instance.optionsDropdown}
</div> : null}
- </div>}
+ </div>} */}
{/* <div className="propertiesView-presTrails">
<div className="propertiesView-presTrails-title"
onPointerDown={action(() => { this.openAddSlide = !this.openAddSlide; })}
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.scss b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.scss
index 75cbc20ca..e92100c50 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.scss
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.scss
@@ -57,7 +57,7 @@
min-height: 15px;
text-align: center;
background-color: #69a6db;
- border-radius: 5px;
+ border-radius: 10%;
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
font-family: Roboto;
font-weight: 500;
@@ -65,6 +65,13 @@
}
}
+.pathOrder-presPinView {
+ position: absolute;
+ z-index: 190000;
+ border-style: dashed;
+ border-color: #69a5db;
+}
+
.progressivizeButton {
position: absolute;
display: grid;
diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index f8f794a4b..d7f15166f 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -808,6 +808,8 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
@computed get order() {
const order: JSX.Element[] = [];
const docs: Doc[] = [];
+ const presCollection = Cast(this.rootDoc.presCollection, Doc, null);
+ const dv = DocumentManager.Instance.getDocumentView(presCollection);
this.childDocs.filter(doc => Cast(doc.presentationTargetDoc, Doc, null)).forEach((doc, index) => {
const tagDoc = Cast(doc.presentationTargetDoc, Doc, null);
const srcContext = Cast(tagDoc.context, Doc, null);
@@ -816,8 +818,9 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
const edge = Math.max(width, height);
const fontSize = edge * 0.8;
const gap = 2;
- // Case A: Document is contained within the collection
- if (this.rootDoc.presCollection === srcContext) {
+ if (presCollection === srcContext) {
+ // Case A: Document is contained within the collection
+ console.log(`-------Case A: ${index}-------`);
if (docs.includes(tagDoc)) {
const prevOccurances: number = this.getAllIndexes(docs, tagDoc).length;
docs.push(tagDoc);
@@ -838,15 +841,33 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
<div className="pathOrder-frame">{index + 1}</div>
</div>);
}
+ } else if (doc.presPinView && presCollection === tagDoc && dv) {
// Case B: Document is presPinView and is presCollection
- } else if (doc.pinWithView && this.layoutDoc.presCollection === tagDoc) {
+ console.log(`-------Case B: ${index}-------`);
+ const scale: number = 1 / NumCast(doc.presPinViewScale);
+ const height: number = dv.props.PanelHeight() * scale;
+ const width: number = dv.props.PanelWidth() * scale;
+ const indWidth = width / 10;
+ const indHeight = Math.max(height / 10, 15);
+ const indEdge = Math.max(indWidth, indHeight);
+ const indFontSize = indEdge * 0.8;
+ const xLoc: number = NumCast(doc.presPinViewX) - (width / 2);
+ const yLoc: number = NumCast(doc.presPinViewY) - (height / 2);
docs.push(tagDoc);
order.push(
- <div className="pathOrder" key={tagDoc.id + 'pres' + index} style={{ top: 0, left: 0 }}>
- <div className="pathOrder-frame">{index + 1}</div>
- </div>);
- // Case C: Document is not contained within presCollection
+ <>
+ <div className="pathOrder"
+ key={tagDoc.id + 'pres' + index}
+ style={{ top: yLoc - (indEdge / 2), left: xLoc - (indEdge / 2), width: indEdge, height: indEdge, fontSize: indFontSize }}
+ onClick={() => this.selectElement(doc)}
+ >
+ <div className="pathOrder-frame">{index + 1}</div>
+ </div>
+ <div className="pathOrder-presPinView" style={{ top: yLoc, left: xLoc, width: width, height: height, borderWidth: indEdge / 10 }}></div>
+ </>);
} else {
+ // Case C: Document is not contained within presCollection
+ console.log(`-------Case C: ${index}-------`);
docs.push(tagDoc);
order.push(
<div className="pathOrder" key={tagDoc.id + 'pres' + index} style={{ position: 'absolute', top: 0, left: 0 }}>
@@ -875,9 +896,11 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
const n1y = NumCast(tagDoc.y) + (NumCast(tagDoc._height) / 2);
if (index = 0) pathPoints = n1x + "," + n1y;
else pathPoints = pathPoints + " " + n1x + "," + n1y;
- } else {
- if (index = 0) pathPoints = 0 + "," + 0;
- else pathPoints = pathPoints + " " + 0 + "," + 0;
+ } else if (doc.presPinView) {
+ const n1x = NumCast(doc.presPinViewX);
+ const n1y = NumCast(doc.presPinViewY);
+ if (index = 0) pathPoints = n1x + "," + n1y;
+ else pathPoints = pathPoints + " " + n1x + "," + n1y;
}
});
return (<polyline
diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx
index 8017468c3..c90395b82 100644
--- a/src/client/views/presentationview/PresElementBox.tsx
+++ b/src/client/views/presentationview/PresElementBox.tsx
@@ -120,14 +120,14 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc
if (this.rootDoc.type === DocumentType.AUDIO) { durationInS = NumCast(this.rootDoc.presEndTime) - NumCast(this.rootDoc.presStartTime); durationInS = Math.round(durationInS * 10) / 10; }
else if (this.rootDoc.presDuration) durationInS = NumCast(this.rootDoc.presDuration) / 1000;
else durationInS = 2;
- return this.rootDoc.presMovement === PresMovement.Jump ? (null) : "D: " + durationInS + "s";
+ return "D: " + durationInS + "s";
}
@computed get transition() {
let transitionInS: number;
if (this.rootDoc.presTransition) transitionInS = NumCast(this.rootDoc.presTransition) / 1000;
else transitionInS = 0.5;
- return "M: " + transitionInS + "s";
+ return this.rootDoc.presMovement === PresMovement.Jump || this.rootDoc.presMovement === PresMovement.None ? (null) : "M: " + transitionInS + "s";
}
private _itemRef: React.RefObject<HTMLDivElement> = React.createRef();