-
-
{ e.stopPropagation(); e.preventDefault(); }}
- onPointerDown={e => {
- if (e.button === 0 && !e.ctrlKey) {
- const rect = (e.target as any).getBoundingClientRect();
-
- if (e.target !== this._audioRef.current) {
- const wasPaused = this.audioState === "paused";
- this._ele!.currentTime = this.layoutDoc.currentTimecode = (e.clientX - rect.x) / rect.width * this.audioDuration;
- wasPaused && this.pause();
+
:
+
+
+
+
+
{ e.stopPropagation(); e.preventDefault(); }}
+ onPointerDown={e => {
+ if (e.button === 0 && !e.ctrlKey) {
+ const rect = (e.target as any).getBoundingClientRect();
+
+ if (e.target !== this._audioRef.current) {
+ const wasPaused = this.audioState === "paused";
+ this._ele!.currentTime = this.layoutDoc.currentTimecode = (e.clientX - rect.x) / rect.width * this.audioDuration;
+ wasPaused && this.pause();
+ }
+
+ this.onPointerDownTimeline(e);
+ }
+ }}>
+
+ {this.waveform}
+
+ {DocListCast(this.dataDoc[this.annotationKey]).map((m, i) =>
+ (!m.isLabel) ?
+ (this.layoutDoc.hideMarkers) ? (null) :
+
{ this.playFrom(NumCast(m.audioStart), NumCast(m.audioEnd)); e.stopPropagation(); }} >
+
this.onPointerDown(e, m, true)}>
+ {markerDoc(m, this.rangeScript)}
+
this.onPointerDown(e, m, false)}>
+
+ :
+ (this.layoutDoc.hideLabels) ? (null) :
+
+ {markerDoc(m, this.labelScript)}
+
+ )}
+ {DocListCast(this.dataDoc.links).map((l, i) => {
+ const { la1, la2, linkTime } = this.getLinkData(l);
+ let startTime = linkTime;
+ if (la2.audioStart && !la2.audioEnd) {
+ startTime = NumCast(la2.audioStart);
}
- this.onPointerDownTimeline(e);
- }
- }}>
-
- {this.waveform}
+ return !linkTime ? (null) :
+
e.stopPropagation()}>
+
+
Doc.linkFollowHighlight(la1)}
+ onPointerDown={e => { if (e.button === 0 && !e.ctrlKey) { this.playFrom(startTime); e.stopPropagation(); e.preventDefault(); } }} />
+
;
+ })}
+ {this._visible ? this.selectionContainer : null}
+
+
{ e.stopPropagation(); e.preventDefault(); }} style={{ left: `${NumCast(this.layoutDoc.currentTimecode) / this.audioDuration * 100}%`, pointerEvents: "none" }} />
+ {this.audio}
+
+
+ {formatTime(Math.round(NumCast(this.layoutDoc.currentTimecode)))}
+
+
+ {formatTime(Math.round(this.audioDuration))}
- {DocListCast(this.dataDoc[this.annotationKey]).map((m, i) =>
- (!m.isLabel) ?
- (this.layoutDoc.hideMarkers) ? (null) :
-
{ this.playFrom(NumCast(m.audioStart), NumCast(m.audioEnd)); e.stopPropagation(); }} >
-
this.onPointerDown(e, m, true)}>
- {markerDoc(m, this.rangeScript)}
-
this.onPointerDown(e, m, false)}>
-
- :
- (this.layoutDoc.hideLabels) ? (null) :
-
- {markerDoc(m, this.labelScript)}
-
- )}
- {DocListCast(this.dataDoc.links).map((l, i) => {
- let { la1, la2, linkTime } = this.getLinkData(l);
- if (la2.audioStart && !la2.audioEnd) {
- linkTime = NumCast(la2.audioStart);
- }
-
- return !linkTime ? (null) :
-
e.stopPropagation()}>
-
-
Doc.linkFollowHighlight(la1)}
- onPointerDown={e => { if (e.button === 0 && !e.ctrlKey) { this.playFrom(linkTime); e.stopPropagation(); e.preventDefault(); } }} />
-
;
- })}
- {this._visible ? this.selectionContainer : null}
-
-
{ e.stopPropagation(); e.preventDefault(); }} style={{ left: `${NumCast(this.layoutDoc.currentTimecode) / this.audioDuration * 100}%`, pointerEvents: "none" }} />
- {this.audio}
-
-
- {formatTime(Math.round(NumCast(this.layoutDoc.currentTimecode)))}
-
-
- {formatTime(Math.round(this.audioDuration))}
-
- }
+ }
;
}
}
--
cgit v1.2.3-70-g09d2
From 1d2851b237fd41f8a8726244b095986699f513a5 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Sun, 9 Aug 2020 23:09:49 -0400
Subject: fixed playing audio on link follow when audio opens on right or in
tab
---
src/client/views/linking/LinkMenuItem.tsx | 9 ++++++++-
src/client/views/nodes/AudioBox.tsx | 4 +++-
2 files changed, 11 insertions(+), 2 deletions(-)
(limited to 'src')
diff --git a/src/client/views/linking/LinkMenuItem.tsx b/src/client/views/linking/LinkMenuItem.tsx
index b95fccf2a..21c666a4d 100644
--- a/src/client/views/linking/LinkMenuItem.tsx
+++ b/src/client/views/linking/LinkMenuItem.tsx
@@ -162,7 +162,14 @@ export class LinkMenuItem extends React.Component {
}
if (linkDoc.followLinkLocation && linkDoc.followLinkLocation !== "Default") {
- this.props.addDocTab(this.props.destinationDoc, StrCast(linkDoc.followLinkLocation));
+ const annotationOn = this.props.destinationDoc.annotationOn as Doc;
+ this.props.addDocTab(annotationOn instanceof Doc ? annotationOn : this.props.destinationDoc, StrCast(linkDoc.followLinkLocation));
+ if (annotationOn) {
+ setTimeout(() => {
+ const dv = DocumentManager.Instance.getFirstDocumentView(this.props.destinationDoc);
+ dv?.props.focus(this.props.destinationDoc, false);
+ });
+ }
} else {
DocumentManager.Instance.FollowLink(this.props.linkDoc, this.props.sourceDoc, doc => this.props.addDocTab(doc, "onRight"), false);
}
diff --git a/src/client/views/nodes/AudioBox.tsx b/src/client/views/nodes/AudioBox.tsx
index 0ea624edf..d689aeadc 100644
--- a/src/client/views/nodes/AudioBox.tsx
+++ b/src/client/views/nodes/AudioBox.tsx
@@ -195,7 +195,9 @@ export class AudioBox extends ViewBoxAnnotatableComponent this.playFrom(seekTimeInSeconds, endTime), 500);
+ } else if (this._ele && AudioBox.Enabled) {
if (seekTimeInSeconds < 0) {
if (seekTimeInSeconds > -1) {
setTimeout(() => this.playFrom(0), -seekTimeInSeconds * 1000);
--
cgit v1.2.3-70-g09d2
From b096129d54238bc4cea735cd2db8e5f3e94613b7 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Sun, 9 Aug 2020 23:23:06 -0400
Subject: fixed playing audio links on select.
---
src/client/views/nodes/AudioBox.tsx | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
(limited to 'src')
diff --git a/src/client/views/nodes/AudioBox.tsx b/src/client/views/nodes/AudioBox.tsx
index d689aeadc..289388320 100644
--- a/src/client/views/nodes/AudioBox.tsx
+++ b/src/client/views/nodes/AudioBox.tsx
@@ -128,14 +128,12 @@ export class AudioBox extends ViewBoxAnnotatableComponent SelectionManager.SelectedDocuments(),
selected => {
- if (this.layoutDoc.playOnSelect) {
- const sel = selected.length ? selected[0].props.Document : undefined;
- const link = sel && DocListCast(this.dataDoc.links).forEach(l => (l.anchor1 === sel || l.anchor2 === sel) && this.playLink(l), false);
- // for links created during recording
- if (!link) {
- this.layoutDoc.playOnSelect && this.recordingStart && sel && sel.creationDate && !Doc.AreProtosEqual(sel, this.props.Document) && this.playFromTime(DateCast(sel.creationDate).date.getTime());
- this.layoutDoc.playOnSelect && this.recordingStart && !sel && this.pause();
- }
+ const sel = selected.length ? selected[0].props.Document : undefined;
+ const link = sel && DocListCast(this.dataDoc.links).forEach(l => (l.anchor1 === sel || l.anchor2 === sel) && this.playLink(sel), false);
+ // for links created during recording
+ if (!link) {
+ this.layoutDoc.playOnSelect && this.recordingStart && sel && sel.creationDate && !Doc.AreProtosEqual(sel, this.props.Document) && this.playFromTime(DateCast(sel.creationDate).date.getTime());
+ this.layoutDoc.playOnSelect && this.recordingStart && !sel && this.pause();
}
});
this._scrubbingDisposer = reaction(() => AudioBox._scrubTime, (time) => this.layoutDoc.playOnSelect && this.playFromTime(AudioBox._scrubTime));
--
cgit v1.2.3-70-g09d2
From 3dab659503e98fe75a9c0671057771ff666d7e10 Mon Sep 17 00:00:00 2001
From: usodhi <61431818+usodhi@users.noreply.github.com>
Date: Mon, 10 Aug 2020 11:16:02 +0530
Subject: default acl private setting created + bugfix
---
src/client/documents/Documents.ts | 2 ++
src/client/util/SettingsManager.scss | 16 ++++++++++++----
src/client/util/SettingsManager.tsx | 6 +++++-
src/client/views/DocComponent.tsx | 3 ++-
src/client/views/collections/CollectionView.tsx | 2 +-
src/fields/Doc.ts | 2 ++
6 files changed, 24 insertions(+), 7 deletions(-)
(limited to 'src')
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 7b11cf0b7..a6a697574 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -577,6 +577,8 @@ export namespace Docs {
viewDoc.author = Doc.CurrentUserEmail;
viewDoc.type !== DocumentType.LINK && DocUtils.MakeLinkToActiveAudio(viewDoc);
+ if (Doc.UserDoc()?.defaultAclPrivate) viewDoc["ACL-Public"] = dataDoc["ACL-Public"] = "Not Shared";
+
return Doc.assign(viewDoc, delegateProps, true);
}
diff --git a/src/client/util/SettingsManager.scss b/src/client/util/SettingsManager.scss
index ca27cfa3c..01dda0aca 100644
--- a/src/client/util/SettingsManager.scss
+++ b/src/client/util/SettingsManager.scss
@@ -99,8 +99,8 @@
display: flex;
.modes-select {
- width: 170px;
- margin-right: 65px;
+ // width: 170px;
+ margin-right: 10px;
color: black;
border-radius: 5px;
@@ -109,10 +109,12 @@
}
}
- .modes-playground {
+ .modes-playground,
+ .default-acl {
display: flex;
- .playground-check {
+ .playground-check,
+ .acl-check {
margin-right: 5px;
&:hover {
@@ -122,7 +124,13 @@
.playground-text {
color: black;
+ margin-right: 10px;
}
+
+ .acl-text {
+ color: black;
+ }
+
}
}
diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx
index 8b58880d4..513cece40 100644
--- a/src/client/util/SettingsManager.tsx
+++ b/src/client/util/SettingsManager.tsx
@@ -40,7 +40,7 @@ export default class SettingsManager extends React.Component<{}> {
}
public close = action(() => this.isOpen = false);
- public open = action(() => (this.isOpen = true) && SelectionManager.DeselectAll());
+ public open = action(() => this.isOpen = true);
private googleAuthorize = action(() => GoogleAuthenticationManager.Instance.fetchOrGenerateAccessToken(true));
private changePassword = async () => {
@@ -136,6 +136,10 @@ export default class SettingsManager extends React.Component<{}> {
Playground Mode
+
+
Doc.UserDoc().defaultAclPrivate = !Doc.UserDoc().defaultAclPrivate)} />
+
Default access private
+
;
}
diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx
index 831c246d1..eea133ed9 100644
--- a/src/client/views/DocComponent.tsx
+++ b/src/client/views/DocComponent.tsx
@@ -158,7 +158,8 @@ export function ViewBoxAnnotatableComponent
{
for (const [key, value] of Object.entries(this.props.Document[AclSym])) {
- distributeAcls(key, this.AclMap.get(value) as SharingPermissions, d, true);
+ if (d.author === key.substring(4).replace("_", ".") && !d.aliasOf) distributeAcls(key, SharingPermissions.Admin, d, true);
+ else distributeAcls(key, this.AclMap.get(value) as SharingPermissions, d, true);
}
});
}
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 837ae7e86..0feec3fbd 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -151,7 +151,7 @@ export class CollectionView extends Touchable {
for (const [key, value] of Object.entries(this.props.Document[AclSym])) {
- if (d.author === Doc.CurrentUserEmail && !d.aliasOf) distributeAcls(key, SharingPermissions.Admin, d, true);
+ if (d.author === key.substring(4).replace("_", ".") && !d.aliasOf) distributeAcls(key, SharingPermissions.Admin, d, true);
else distributeAcls(key, this.AclMap.get(value) as SharingPermissions, d, true);
}
});
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index 6bfe91378..b535fea5a 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -770,6 +770,7 @@ export namespace Doc {
}
});
copy.author = Doc.CurrentUserEmail;
+ Doc.UserDoc().defaultAclPrivate && (copy["ACL-Public"] = "Not Shared");
return copy;
}
@@ -794,6 +795,7 @@ export namespace Doc {
const applied = ApplyTemplateTo(templateDoc, target, targetKey, templateDoc.title + "(..." + _applyCount++ + ")");
target.layoutKey = targetKey;
applied && (Doc.GetProto(applied).type = templateDoc.type);
+ Doc.UserDoc().defaultAclPrivate && (applied["ACL-Public"] = "Not Shared");
return applied;
}
return undefined;
--
cgit v1.2.3-70-g09d2
From d4ca38801b19e38b49b087be3e510cc0fca33eb8 Mon Sep 17 00:00:00 2001
From: yunahi <60233430+yunahi@users.noreply.github.com>
Date: Mon, 10 Aug 2020 22:20:15 +0900
Subject: fixed line, able to add/delete control points
---
src/client/util/InteractionUtils.tsx | 60 ++++++++++++++++-
src/client/views/GestureOverlay.tsx | 30 ++++-----
src/client/views/InkingStroke.tsx | 30 ++++++++-
.../collectionFreeForm/FormatShapePane.tsx | 76 ++++++++++++++++++++++
4 files changed, 176 insertions(+), 20 deletions(-)
(limited to 'src')
diff --git a/src/client/util/InteractionUtils.tsx b/src/client/util/InteractionUtils.tsx
index 04a750f93..ae3b3e064 100644
--- a/src/client/util/InteractionUtils.tsx
+++ b/src/client/util/InteractionUtils.tsx
@@ -91,15 +91,61 @@ export namespace InteractionUtils {
return myTouches;
}
- export function CreatePolyline(points: { X: number, Y: number }[], left: number, top: number,
+ export function CreatePoints(points: { X: number, Y: number }[], left: number, top: number,
color: string, width: number, strokeWidth: number, bezier: string, fill: string, arrowStart: string, arrowEnd: string,
dash: string, scalex: number, scaley: number, shape: string, pevents: string, drawHalo: boolean, nodefs: boolean) {
+ let pts: { X: number; Y: number; }[] = [];
+ if (shape) { //if any of the shape are true
+ pts = makePolygon(shape, points);
+ }
+ else if ((points.length >= 5 && points[3].X === points[4].X) || (points.length === 4)) {
+ for (var i = 0; i < points.length - 3; i += 4) {
+ const array = [[points[i].X, points[i].Y], [points[i + 1].X, points[i + 1].Y], [points[i + 2].X, points[i + 2].Y], [points[i + 3].X, points[i + 3].Y]];
+ for (var t = 0; t < 1; t += 0.01) {
+ const point = beziercurve(t, array);
+ pts.push({ X: point[0], Y: point[1] });
+ }
+ }
+ }
+ else if (points.length > 1 && points[points.length - 1].X === points[0].X && points[points.length - 1].Y === points[0].Y) {
+ //pointer is up (first and last points are the same)
+ const newPoints = points.reduce((p, pts) => { p.push([pts.X, pts.Y]); return p; }, [] as number[][]);
+ newPoints.pop();
+ const bezierCurves = fitCurve(newPoints, parseInt(bezier));
+ for (const curve of bezierCurves) {
+ for (var t = 0; t < 1; t += 0.01) {
+ const point = beziercurve(t, curve);
+ pts.push({ X: point[0], Y: point[1] });
+ }
+ }
+ } else {
+ pts = points.slice();
+ // bcz: Ugh... this is ugly, but shapes apprently have an extra point added that is = (p[0].x,p[0].y+1) as some sort of flag. need to remove it here.
+ if (pts.length > 2 && pts[pts.length - 2].X === pts[0].X && pts[pts.length - 2].Y === pts[0].Y) {
+ pts.pop();
+ }
+ }
+ if (isNaN(scalex)) {
+ scalex = 1;
+ }
+ if (isNaN(scaley)) {
+ scaley = 1;
+ }
+ console.log(pts.length);
+ return pts;
+ }
+
+
+
+ export function CreatePolyline(points: { X: number, Y: number }[], left: number, top: number,
+ color: string, width: number, strokeWidth: number, bezier: string, fill: string, arrowStart: string, arrowEnd: string,
+ dash: string, scalex: number, scaley: number, shape: string, pevents: string, drawHalo: boolean, nodefs: boolean) {
let pts: { X: number; Y: number; }[] = [];
if (shape) { //if any of the shape are true
pts = makePolygon(shape, points);
}
- else if (points.length >= 5 && points[3].X === points[4].X) {
+ else if ((points.length >= 5 && points[3].X === points[4].X) || (points.length === 4)) {
for (var i = 0; i < points.length - 3; i += 4) {
const array = [[points[i].X, points[i].Y], [points[i + 1].X, points[i + 1].Y], [points[i + 2].X, points[i + 2].Y], [points[i + 3].X, points[i + 3].Y]];
for (var t = 0; t < 1; t += 0.01) {
@@ -139,6 +185,15 @@ export namespace InteractionUtils {
const dashArray = String(Number(width) * Number(dash));
const defGuid = Utils.GenerateGuid();
const arrowDim = Math.max(0.5, 8 / Math.log(Math.max(2, strokeWidth)));
+
+ const addables = pts.map((pts, i) =>
+ );
+
+
return ();
}
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx
index 30df7cf9a..a9fc20174 100644
--- a/src/client/views/GestureOverlay.tsx
+++ b/src/client/views/GestureOverlay.tsx
@@ -817,21 +817,21 @@ export default class GestureOverlay extends Touchable {
// const b = firsty - m * firstx;
this._points.push({ X: firstx, Y: firsty });
this._points.push({ X: firstx, Y: firsty });
-
- this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
- this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
- this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
- this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
-
- this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
- this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
- this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
- this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
-
- this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
- this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
- this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
- this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
+ //removed points
+ // this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
+ // this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
+ // this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
+ // this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
+
+ // this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
+ // this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
+ // this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
+ // this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
+
+ // this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
+ // this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
+ // this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
+ // this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
this._points.push({ X: firstx + 4 * fourth, Y: m * (firstx + 4 * fourth) + b });
this._points.push({ X: firstx + 4 * fourth, Y: m * (firstx + 4 * fourth) + b });
diff --git a/src/client/views/InkingStroke.tsx b/src/client/views/InkingStroke.tsx
index fe5bf1eb2..0afc71e9b 100644
--- a/src/client/views/InkingStroke.tsx
+++ b/src/client/views/InkingStroke.tsx
@@ -52,8 +52,8 @@ export class InkingStroke extends ViewBoxBaseComponent {
@@ -67,6 +67,7 @@ export class InkingStroke extends ViewBoxBaseComponent {
FormatShapePane.Instance._currPoint = i;
+ document.addEventListener("keydown", this.delPts, true);
}
@action
@@ -86,6 +87,13 @@ export class InkingStroke extends ViewBoxBaseComponent {
+ if (e instanceof KeyboardEvent ? e.key === "-" : true) {
+ FormatShapePane.Instance.deletePoints();
+ }
+ }
+
public static MaskDim = 50000;
render() {
@@ -115,6 +123,12 @@ export class InkingStroke extends ViewBoxBaseComponent
+
+ );
+
const controls = controlPoints.map((pts, i) =>
);
const handles = handlePoints.map((pts, i) =>
@@ -193,6 +216,7 @@ export class InkingStroke extends ViewBoxBaseComponent
{hpoints}
{points}
+ {FormatShapePane.Instance._controlBtn && this.props.isSelected() ? addpoints : ""}
{FormatShapePane.Instance._controlBtn && this.props.isSelected() ? controls : ""}
{FormatShapePane.Instance._controlBtn && this.props.isSelected() ? handles : ""}
{FormatShapePane.Instance._controlBtn && this.props.isSelected() ? handleLines : ""}
diff --git a/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx b/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx
index d526033a0..e805f9282 100644
--- a/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx
+++ b/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx
@@ -161,6 +161,82 @@ export default class FormatShapePane extends AntimodeMenu {
}
}
+ @undoBatch
+ @action
+ addPoints = (x: number, y: number, pts: { X: number, Y: number }[], index: number, control: { X: number, Y: number }[]) => {
+ this.selectedInk?.forEach(action(inkView => {
+ if (this.selectedInk?.length === 1) {
+ const doc = Document(inkView.rootDoc);
+ if (doc.type === DocumentType.INK) {
+ const ink = Cast(doc.data, InkField)?.inkData;
+ if (ink) {
+ const newPoints: { X: number, Y: number }[] = [];
+ var counter = 0;
+ for (var k = 0; k < index; k++) {
+ for (var l = 0; l < control.length; l++) {
+ if (pts[k].X === control[l].X && pts[k].Y === control[l].Y) {
+ counter++;
+ }
+ }
+ }
+ //decide where to put the new coordinate
+ const spNum = Math.floor(counter / 2) * 4 + 2;
+
+ for (var i = 0; i < spNum; i++) {
+ newPoints.push({ X: ink[i].X, Y: ink[i].Y });
+ }
+ for (var j = 0; j < 4; j++) {
+ newPoints.push({ X: x, Y: y });
+
+ }
+ for (var i = spNum; i < ink.length; i++) {
+ newPoints.push({ X: ink[i].X, Y: ink[i].Y });
+ }
+ this._currPoint = -1;
+ doc.data = new InkField(newPoints);
+ }
+ }
+ }
+ }));
+ }
+
+ @undoBatch
+ @action
+ deletePoints = () => {
+ this.selectedInk?.forEach(action(inkView => {
+ if (this.selectedInk?.length === 1 && this._currPoint !== -1) {
+ const doc = Document(inkView.rootDoc);
+ if (doc.type === DocumentType.INK) {
+ const ink = Cast(doc.data, InkField)?.inkData;
+ if (ink && ink.length > 4) {
+ const newPoints: { X: number, Y: number }[] = [];
+
+ console.log(ink.length, this._currPoint, Math.floor((this._currPoint + 2) / 4));
+
+ const toRemove = Math.floor(((this._currPoint + 2) / 4));
+ for (var i = 0; i < ink.length; i++) {
+ if (Math.floor((i + 2) / 4) !== toRemove) {
+ console.log(i, toRemove);
+ newPoints.push({ X: ink[i].X, Y: ink[i].Y });
+ }
+ }
+ this._currPoint = -1;
+ doc.data = new InkField(newPoints);
+ if (newPoints.length === 4) {
+ const newerPoints: { X: number, Y: number }[] = [];
+ newerPoints.push({ X: newPoints[0].X, Y: newPoints[0].Y });
+ newerPoints.push({ X: newPoints[0].X, Y: newPoints[0].Y });
+ newerPoints.push({ X: newPoints[3].X, Y: newPoints[3].Y });
+ newerPoints.push({ X: newPoints[3].X, Y: newPoints[3].Y });
+ doc.data = new InkField(newerPoints);
+
+ }
+ }
+ }
+ }
+ }));
+ }
+
@undoBatch
@action
rotate = (angle: number) => {
--
cgit v1.2.3-70-g09d2
From 03ae3477dac354eff9178dac701ee40e394434c9 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Mon, 10 Aug 2020 10:37:07 -0400
Subject: fixed issues with presentationBox grabbing all keyboard events and
preventing title edits among others. fixed runtime errors. fixed
groupManager to open again.
---
src/client/util/SettingsManager.tsx | 2 +-
src/client/views/GlobalKeyHandler.ts | 4 +++-
.../views/collections/CollectionDockingView.tsx | 12 +++++++----
.../collectionFreeForm/MarqueeOptionsMenu.tsx | 12 ++++-------
src/client/views/nodes/PresBox.tsx | 24 ++++++++++++++++++----
5 files changed, 36 insertions(+), 18 deletions(-)
(limited to 'src')
diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx
index 513cece40..e3b91925a 100644
--- a/src/client/util/SettingsManager.tsx
+++ b/src/client/util/SettingsManager.tsx
@@ -146,7 +146,7 @@ export default class SettingsManager extends React.Component<{}> {
@computed get accountsContent() {
return
-
+
;
}
diff --git a/src/client/views/GlobalKeyHandler.ts b/src/client/views/GlobalKeyHandler.ts
index 0ea02e3cb..182f6397c 100644
--- a/src/client/views/GlobalKeyHandler.ts
+++ b/src/client/views/GlobalKeyHandler.ts
@@ -108,7 +108,9 @@ export default class KeyManager {
GoogleAuthenticationManager.Instance.cancel();
SharingManager.Instance.close();
GroupManager.Instance.close();
- CollectionFreeFormViewChrome.Instance.clearKeep();
+ CollectionFreeFormViewChrome.Instance?.clearKeep();
+ window.getSelection()?.empty();
+ document.body.focus();
break;
case "delete":
case "backspace":
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 7e096fa37..0c93b4e63 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -513,7 +513,11 @@ export class CollectionDockingView extends React.Component tab.titleElement[0].focus();
+ tab.titleElement[0].onclick = (e: any) => {
+ if (Date.now() - tab.titleElement[0].lastClick < 1000) tab.titleElement[0].select();
+ tab.titleElement[0].lastClick = Date.now();
+ tab.titleElement[0].focus();
+ }
tab.titleElement[0].onchange = (e: any) => {
tab.titleElement[0].size = e.currentTarget.value.length + 1;
Doc.GetProto(doc).title = e.currentTarget.value, true;
@@ -691,8 +695,8 @@ export class DockedFrameRenderer extends React.Component {
return (this.props as any).glContainer.parent.parent;
}
get _tab(): any {
- const tab = (this.props as any).glContainer.tab.element[0] as HTMLElement;
- return tab.getElementsByClassName("lm_title")?.[0];
+ const tab = (this.props as any).glContainer.tab?.element[0] as HTMLElement;
+ return tab?.getElementsByClassName("lm_title")?.[0];
}
constructor(props: any) {
super(props);
@@ -757,7 +761,7 @@ export class DockedFrameRenderer extends React.Component {
this._tabReaction = reaction(() => ({ views: SelectionManager.SelectedDocuments(), color: StrCast(this._document?._backgroundColor, "white") }),
(data) => {
const selected = data.views.some(v => Doc.AreProtosEqual(v.props.Document, this._document));
- this._tab.style.backgroundColor = selected ? data.color : "";
+ this._tab && (this._tab.style.backgroundColor = selected ? data.color : "");
}
);
}
diff --git a/src/client/views/collections/collectionFreeForm/MarqueeOptionsMenu.tsx b/src/client/views/collections/collectionFreeForm/MarqueeOptionsMenu.tsx
index d27ca7c3a..f1df7998b 100644
--- a/src/client/views/collections/collectionFreeForm/MarqueeOptionsMenu.tsx
+++ b/src/client/views/collections/collectionFreeForm/MarqueeOptionsMenu.tsx
@@ -25,34 +25,30 @@ export default class MarqueeOptionsMenu extends AntimodeMenu {
render() {
const buttons = [
- Create a Collection
>} placement="bottom">
+ Create a Collection
>} placement="bottom">
,
- Summarize Documents
>} placement="bottom">
+ Summarize Documents
>} placement="bottom">
,
- Delete Documents
>} placement="bottom">
+ Delete Documents
>} placement="bottom">
,
- Change to Text
>} placement="bottom">
+ Change to Text
>} placement="bottom">
diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index b7af4683e..849fc4076 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -83,6 +83,7 @@ export class PresBox extends ViewBoxBaseComponent
}
@computed get isPres(): boolean {
if (this.selectedDoc?.type === DocumentType.PRES) {
+ document.removeEventListener("keydown", this.keyEvents, true);
document.addEventListener("keydown", this.keyEvents, true);
return true;
} else {
@@ -91,6 +92,9 @@ export class PresBox extends ViewBoxBaseComponent
}
}
@computed get selectedDoc() { return this.selectedDocumentView?.rootDoc; }
+ componentWillUnmount() {
+ document.removeEventListener("keydown", this.keyEvents, true);
+ }
componentDidMount() {
this.rootDoc.presBox = this.rootDoc;
@@ -517,29 +521,41 @@ export class PresBox extends ViewBoxBaseComponent
// Key for when the presentaiton is active (according to Selection Manager)
@action
keyEvents = (e: KeyboardEvent) => {
- e.stopPropagation();
- e.preventDefault();
-
+ let handled = false;
+ const anchorNode = document.activeElement as HTMLDivElement;
+ if (anchorNode && anchorNode.className?.includes("lm_title")) return;
if (e.keyCode === 27) { // Escape key
if (this.layoutDoc.presStatus === "edit") this._selectedArray = [];
else this.layoutDoc.presStatus = "edit";
+ handled = true;
} if ((e.metaKey || e.altKey) && e.keyCode === 65) { // Ctrl-A to select all
- if (this.layoutDoc.presStatus === "edit") this._selectedArray = this.childDocs;
+ if (this.layoutDoc.presStatus === "edit") {
+ this._selectedArray = this.childDocs;
+ handled = true;
+ }
} if (e.keyCode === 37 || e.keyCode === 38) { // left(37) / a(65) / up(38) to go back
this.back();
+ handled = true;
} if (e.keyCode === 39 || e.keyCode === 40) { // right (39) / d(68) / down(40) to go to next
this.next();
+ handled = true;
} if (e.keyCode === 32) { // spacebar to 'present' or autoplay
if (this.layoutDoc.presStatus !== "edit") this.startAutoPres(0);
else this.layoutDoc.presStatus = "manual";
+ handled = true;
}
if (e.keyCode === 8) { // delete selected items
if (this.layoutDoc.presStatus === "edit") {
this._selectedArray.forEach((doc, i) => {
this.removeDocument(doc);
});
+ handled = true;
}
}
+ if (handled) {
+ e.stopPropagation();
+ e.preventDefault();
+ }
}
/**
--
cgit v1.2.3-70-g09d2
From 9351115c7ed7426f6e796a8d9310789c19ed86ef Mon Sep 17 00:00:00 2001
From: bobzel
Date: Mon, 10 Aug 2020 10:45:50 -0400
Subject: fixed warnings
---
src/client/views/GestureOverlay.tsx | 59 ----------------------
.../collectionFreeForm/FormatShapePane.tsx | 6 +--
src/client/views/linking/LinkEditor.tsx | 2 +-
3 files changed, 2 insertions(+), 65 deletions(-)
(limited to 'src')
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx
index a9fc20174..81bb542dd 100644
--- a/src/client/views/GestureOverlay.tsx
+++ b/src/client/views/GestureOverlay.tsx
@@ -733,19 +733,8 @@ export default class GestureOverlay extends Touchable {
this._points.push({ X: left, Y: top });
this._points.push({ X: left, Y: top });
- // this._points.push({ X: left, Y: top });
-
- // this._points.push({ X: left, Y: top });
- // this._points.push({ X: left, Y: top });
-
- // this._points.push({ X: left, Y: top - 1 });
break;
case "triangle":
- // this._points.push({ X: left, Y: bottom });
- // this._points.push({ X: right, Y: bottom });
- // this._points.push({ X: (right + left) / 2, Y: top });
- // this._points.push({ X: left, Y: bottom });
- // this._points.push({ X: left, Y: bottom - 1 });
this._points.push({ X: left, Y: bottom });
this._points.push({ X: left, Y: bottom });
@@ -779,59 +768,11 @@ export default class GestureOverlay extends Touchable {
}
this._points.push({ X: Math.sqrt(Math.pow(radius, 2) - (Math.pow((top - centerY), 2))) + centerX, Y: top });
this._points.push({ X: Math.sqrt(Math.pow(radius, 2) - (Math.pow((top - centerY), 2))) + centerX, Y: top - 1 });
- // this._points.push({ X: centerX, Y: top });
- // this._points.push({ X: centerX + radius / 2, Y: top });
-
- // this._points.push({ X: right, Y: top + radius / 2 });
- // this._points.push({ X: right, Y: top + radius });
- // this._points.push({ X: right, Y: top + radius });
- // this._points.push({ X: right, Y: bottom - radius / 2 });
-
- // this._points.push({ X: right - radius / 2, Y: bottom });
- // this._points.push({ X: right - radius, Y: bottom });
- // this._points.push({ X: right - radius, Y: bottom });
- // this._points.push({ X: left + radius / 2, Y: bottom });
-
- // this._points.push({ X: left, Y: bottom - radius / 2 });
- // this._points.push({ X: left, Y: bottom - radius });
- // this._points.push({ X: left, Y: bottom - radius });
- // this._points.push({ X: left, Y: top + radius / 2 });
-
- // this._points.push({ X: left + radius / 2, Y: top });
- // this._points.push({ X: left + radius, Y: top });
-
-
-
-
-
-
break;
case "line":
- // const firstx = this._points[0].X;
- // const firsty = this._points[0].Y;
- // const lastx = this._points[this._points.length - 1].X;
- // const lasty = this._points[this._points.length - 1].Y;
- // const fourth = (lastx - firstx) / 4;
- // const m = (lasty - firsty) / (lastx - firstx);
- // const b = firsty - m * firstx;
this._points.push({ X: firstx, Y: firsty });
this._points.push({ X: firstx, Y: firsty });
- //removed points
- // this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
- // this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
- // this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
- // this._points.push({ X: firstx + fourth, Y: m * (firstx + fourth) + b });
-
- // this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
- // this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
- // this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
- // this._points.push({ X: firstx + 2 * fourth, Y: m * (firstx + 2 * fourth) + b });
-
- // this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
- // this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
- // this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
- // this._points.push({ X: firstx + 3 * fourth, Y: m * (firstx + 3 * fourth) + b });
this._points.push({ X: firstx + 4 * fourth, Y: m * (firstx + 4 * fourth) + b });
this._points.push({ X: firstx + 4 * fourth, Y: m * (firstx + 4 * fourth) + b });
diff --git a/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx b/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx
index c53e4de0f..1ffa2fbed 100644
--- a/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx
+++ b/src/client/views/collections/collectionFreeForm/FormatShapePane.tsx
@@ -173,11 +173,7 @@ export default class FormatShapePane extends AntimodeMenu {
const newPoints: { X: number, Y: number }[] = [];
var counter = 0;
for (var k = 0; k < index; k++) {
- for (var l = 0; l < control.length; l++) {
- if (pts[k].X === control[l].X && pts[k].Y === control[l].Y) {
- counter++;
- }
- }
+ control.forEach(pt => (pts[k].X === pt.X && pts[k].Y === pt.Y) && counter++);
}
//decide where to put the new coordinate
const spNum = Math.floor(counter / 2) * 4 + 2;
diff --git a/src/client/views/linking/LinkEditor.tsx b/src/client/views/linking/LinkEditor.tsx
index 1d71fff04..c9e39cf7b 100644
--- a/src/client/views/linking/LinkEditor.tsx
+++ b/src/client/views/linking/LinkEditor.tsx
@@ -359,7 +359,7 @@ export class LinkEditor extends React.Component {
changeFollowBehavior = action((follow: string) => {
this.openDropdown = false;
Doc.GetProto(this.props.linkDoc).followLinkLocation = follow;
- })
+ });
@computed
get followingDropdown() {
--
cgit v1.2.3-70-g09d2
From bf11e55b42406405bac72a0e533b18d792640768 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Mon, 10 Aug 2020 10:46:12 -0400
Subject: from last
---
src/client/views/collections/CollectionDockingView.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src')
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 0c93b4e63..3691e844f 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -517,7 +517,7 @@ export class CollectionDockingView extends React.Component {
tab.titleElement[0].size = e.currentTarget.value.length + 1;
Doc.GetProto(doc).title = e.currentTarget.value, true;
--
cgit v1.2.3-70-g09d2
From 8001f8aa447729d667f8e903f9d3dc7766ef3320 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Mon, 10 Aug 2020 14:11:24 -0400
Subject: fixed general list problem where elements weren't converted to Docs.
Symptom was documents now showing up in Shared Docs panel after making and
deleting an alias of a shared doc.
---
src/client/DocServer.ts | 3 +++
1 file changed, 3 insertions(+)
(limited to 'src')
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index 2fe3e9778..a36dfaf69 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -372,6 +372,9 @@ export namespace DocServer {
} else if (cached instanceof Promise) {
proms.push(cached as any);
}
+ } else if (_cache[field.id] instanceof Promise) {
+ proms.push(_cache[field.id] as any);
+ (_cache[field.id] as any).then((f: any) => fieldMap[field.id] = f);
} else if (field) {
proms.push(_cache[field.id] as any);
fieldMap[field.id] = field;
--
cgit v1.2.3-70-g09d2